8 months 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.jsUsing
next@14.2.30Docker-based deployment on Railway
Current
startscript:"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 buildis generating anout/directory.But my Dockerfile or
package.jsonis 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 startwithserve 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
8 months ago
You should be able to deploy a static site with railpack