9 days ago
Hey Railway team
I have a front-end-only Next.js 14 app deployed to Railway. The deployment completes successfully, but shortly after, it crashes repeatedly with the following error:
Error: "next start" does not work with "output: export" configuration. Use "npx serve@latest out" instead.
Context:
App is static only (no backend)
output: 'export'
is set innext.config.js
Using
next@14.2.30
Docker-based deployment on Railway
Current
start
script:"start": "next start -p $PORT"
Logs:
▲ Next.js 14.2.30 ✓ Starting... Error: "next start" does not work with "output: export" configuration. Use "npx serve@latest out" instead.
What I believe is happening:
Since I’m using static export (
output: 'export'
),next build
is generating anout/
directory.But my Dockerfile or
package.json
is usingnext start
, which only works with server-rendered apps.
Question:
What’s the best way to configure a static-only Next.js app with output: export
to run properly on Railway?
Do I need to:
Replace
next start
withserve out
?Adjust my Dockerfile accordingly?
Switch to the Railway Static project type instead of a container?
Any advice or examples would be appreciated!
Thanks
1 Replies
9 days ago
You should be able to deploy a static site with railpack