Deploy NextJS 16 crash with start template
agusgarcia3007
PROOP

2 months ago

I create a plain next Js app with
```
bun create next-app@latest .
```

then I push and deploy it but it crashes and says:

error: ENOENT

error: ENOENT

I don't have much more information

Solved$10 Bounty

1 Replies

domehane
FREE

2 months ago

the problem is your package.json scripts need the --bun flag otherwise railway gets confused

basically just update your package.json scripts to this:

{
  "scripts": {
    "dev": "bun --bun next dev",
    "build": "bun --bun next build",
    "start": "bun --bun next start"
  }
}

then create a railway.json file in your root:

{
  "build": {
    "builder": "RAILPACK",
    "buildCommand": "bun --bun run build"
  },
  "deploy": {
    "startCommand": "bun --bun run start"
  }
}

also make sure you only have bun.lockb and not package-lock.json, delete package-lock if its there. and double check that .next/ is in your gitignore so you're not pushing build files

commit and push again and it should work

if it still crashes go to your railway dashboard settings and manually set the build command to "bun --bun run build" and start command to "bun --bun run start"


Status changed to Solved brody 2 months ago


Loading...