Bun 1.0 on railway

I am spinning up a simple bun app with 1 file in it. But for some reason all of my builds are failing. I am using bun build ./index.tsx --outdir ./build from bun's documentation to build. This is my service ID: b741e4ae-cac8-410f-a15a-be6e2551fa96 Any help would be appreciated.
56 Replies
Percy
Percy15mo ago
Project ID: b741e4ae-cac8-410f-a15a-be6e2551fa96
fedev
fedev15mo ago
just directly run index.tsx with bun, it supports typescript
"scripts": {
"start": "bun ./index.tsx"
},
"scripts": {
"start": "bun ./index.tsx"
},
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
And this is the build command or the start?
fedev
fedev15mo ago
start in the package json
fedev
fedev15mo ago
do you have theese empty?
No description
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
I do now, before I had bun build and bun index.ts there
fedev
fedev15mo ago
try adding only start in package and leaving those empty
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
So add, "start package.json" for the start command? Or do I put bun ./index.tsx because I have tried those and they failed
fedev
fedev15mo ago
can you send your package.json?
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
{
"name": "andromeda-backend",
"module": "index.ts",
"type": "module",
"devDependencies": {
"bun-types": "latest"
},
"scripts": {
"start": "bun ./index.tsx"
},
"peerDependencies": {
"typescript": "^5.0.0"
}
}
{
"name": "andromeda-backend",
"module": "index.ts",
"type": "module",
"devDependencies": {
"bun-types": "latest"
},
"scripts": {
"start": "bun ./index.tsx"
},
"peerDependencies": {
"typescript": "^5.0.0"
}
}
fedev
fedev15mo ago
have you tried deploying it like this?
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
I have been trying with this package.json the whole time
fedev
fedev15mo ago
have the same settings and it works for me have you initialized with bun init?
root
root15mo ago
If that doesn't work, you could try removing all of your custom configuration. Make sure you've run bun install and are committing your bun.lockb.
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
I have run bun init, and bun run index along with bun install. I have it working just fine on my local. This is the error from railway #10 0.237 /bin/bash: line 1: npm: command not found #10 ERROR: process "/bin/bash -ol pipefail -c npm ci" did not complete successfully: exit code: 127
luna
luna15mo ago
Had bun been updated to 1 in railway yet? I’m still running my own dockerfile because of how out of date it was last time I checked. Also why are you doing a build and not just bun run?
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
Hi, where should I put bun run? In the start command?
luna
luna15mo ago
Yes. That’s what you’re using locally, no?
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
And that would be the start command?
luna
luna15mo ago
Yep. That’s all I use for my bun projects
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
It is still failing with ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm ci" did not complete successfully: exit code: 127
luna
luna15mo ago
There’s something you’re missing here. Npm shouldn’t be getting called? Does it show the bun version in the railway logs by chance?
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
It does not
║ setup │ bun ║

║ start │ bun run index.ts ║

#3 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1693872184

#4 [stage-0 1/19] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1693872184@sha256:c90dd7da0f961900970339c955170d2c852fee6ba73ccd2c7895f1999ff92609

#10 [stage-0 6/8] RUN --mount=type=cache,id=s/b741e4ae-cac8-410f-a15a-be6e2551fa96-/root/bun,target=/root/.bun npm ci

> [stage-0 6/8] RUN --mount=type=cache,id=s/b741e4ae-cac8-410f-a15a-be6e2551fa96-/root/bun,target=/root/.bun npm ci:

20 | >>> RUN --mount=type=cache,id=s/b741e4ae-cac8-410f-a15a-be6e2551fa96-/root/bun,target=/root/.bun npm ci
║ setup │ bun ║

║ start │ bun run index.ts ║

#3 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1693872184

#4 [stage-0 1/19] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1693872184@sha256:c90dd7da0f961900970339c955170d2c852fee6ba73ccd2c7895f1999ff92609

#10 [stage-0 6/8] RUN --mount=type=cache,id=s/b741e4ae-cac8-410f-a15a-be6e2551fa96-/root/bun,target=/root/.bun npm ci

> [stage-0 6/8] RUN --mount=type=cache,id=s/b741e4ae-cac8-410f-a15a-be6e2551fa96-/root/bun,target=/root/.bun npm ci:

20 | >>> RUN --mount=type=cache,id=s/b741e4ae-cac8-410f-a15a-be6e2551fa96-/root/bun,target=/root/.bun npm ci
This is all it says filtering for bun This is an old project that I am converting to bun, it could be that is the issue. Although I created a new project and it also failed to build
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
It does, I looked at the link and I don't have node in my package.json
luna
luna15mo ago
okay, try using that newer nixpack and see if that helps otherwise you could always add a Dockerfile similar to this. might need to change a few things.
FROM oven/bun

WORKDIR /app

COPY src /app/src
COPY bun.lockb package.json tsconfig.json /app/

RUN bun i

CMD bun run start
FROM oven/bun

WORKDIR /app

COPY src /app/src
COPY bun.lockb package.json tsconfig.json /app/

RUN bun i

CMD bun run start
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
still failing with
Dockerfile:20

-------------------

18 | ENV NIXPACKS_PATH /app/node_modules/.bin:$NIXPACKS_PATH

19 | COPY . /app/.

20 | >>> RUN --mount=type=cache,id=s/b741e4ae-cac8-410f-a15a-be6e2551fa96-/root/bun,target=/root/.bun npm ci

21 |

22 | # build phase

-------------------

ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm ci" did not complete successfully: exit code: 127



Error: Docker build failed
Dockerfile:20

-------------------

18 | ENV NIXPACKS_PATH /app/node_modules/.bin:$NIXPACKS_PATH

19 | COPY . /app/.

20 | >>> RUN --mount=type=cache,id=s/b741e4ae-cac8-410f-a15a-be6e2551fa96-/root/bun,target=/root/.bun npm ci

21 |

22 | # build phase

-------------------

ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm ci" did not complete successfully: exit code: 127



Error: Docker build failed
luna
luna15mo ago
lol why it it using npm 🤦‍♀️ @Brody is the nixpack for bun using npm? 🤔
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
I just added the .toml file, is there a way to change it from there?
Brody
Brody15mo ago
just looks like nixpacks is detecting node instead of bun
luna
luna15mo ago
@.dylangm do you a commited bun lock file in your repo? 🤔
Brody
Brody15mo ago
root
root15mo ago
no
Brody
Brody15mo ago
please follow the 3 steps
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
My browser isn't letting me add it as a bookmarklet, it's just working like a usual bookmark
root
root15mo ago
You dragged the "Download Logs" button to your bookmarks bar?
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
I feel like the link could be more clear for idiots like me
Brody
Brody15mo ago
Drag this link to your bookmarks bar
but hey congrats
luna
luna15mo ago
lol what. nixpacks you're drunk.
║ setup │ bun ║ ║───────────────────────────────║ ║ install │ npm ci ║
root
root15mo ago
hrrrm
Brody
Brody15mo ago
what indeed
root
root15mo ago
You have no custom configuration whatsoever?
Brody
Brody15mo ago
any railway.json?
root
root15mo ago
any nixpacks.toml? anything in the service settings?
luna
luna15mo ago
"maybe" 😅
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
Only added the .toml file luna suggested, [phases.setup] nixpkgsArchive = 'c054b2a07bce2be3b85fed85f45aea6a4b97f5cc'
root
root15mo ago
hmmm
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
There's no railway.json in my project, here is the repo https://github.com/DylanBozarth/Andromeda-Backend
GitHub
GitHub - DylanBozarth/Andromeda-Backend
Contribute to DylanBozarth/Andromeda-Backend development by creating an account on GitHub.
root
root15mo ago
Remove package-lock.json
Brody
Brody15mo ago
i was typing that lol speed
luna
luna15mo ago
the instant brain sync 😆 also you'll likely want to set the port to use process.env.PORT not hardcode it to 2999.
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
Wow, it looks like it worked. So was the package-lock left over from the node project?
luna
luna15mo ago
yep
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
Wow, I tried everything but that because I'm so used to seeing that in a project
Brody
Brody15mo ago
luna is right, this is important, please dont forget
Dylan-The-Villian
Dylan-The-VillianOP15mo ago
Thank you all for your help.
Want results from more Discord servers?
Add your server