Nextjs 16 Build failing due to incorrect Node.js version detection

imaxisxd
HOBBYOP

17 days ago

https://stackoverflow.com/questions/79749967/error-deploying-angular-20-on-railway-node-js-unsupported-version-v22-11-0-ins

My Next.js 16 application is failing to build on Railway because the platform is using Node.js 18.20.4 instead of the required Node.js version >=20.9.0.

**Error Message:**
```
$ bun run next build
You are using Node.js 18.20.4. For Next.js, Node.js version ">=20.9.0" is required.
error: "next" exited with code 1
```

**What I've Already Configured:**

1. ✅ Added `engines` field to `package.json`:
   ```json
   "engines": {
     "node": ">=20.9.0"
   }
   ```
$10 Bounty

3 Replies

Railway
BOT

17 days ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


jimmyb
FREE

17 days ago

Hello!

That's a bit odd, using engines with the specified version should work. Could you share your entire package.json file? Do you have any other package.json files in your application? I'm wondering if that might be causing the issue or overriding what you're setting. Can you try adding an environment variable to your service to see if that makes a difference?

RAILPACK_NODE_VERSION=20

Once that is done redeploy to see if that solves the issue.


17 days ago

Hey, another user had a similar issue with Bun and Next.js 16 and solved it by adding the line below to their package.json file.

"packageManager": "bun@1.3.1^"

Loading...