Deployment Crashing Due to "next start" with output: export in Next.js 14

devsubairariyil
HOBBY

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 in next.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 an out/ directory.

  • But my Dockerfile or package.json is using next 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 with serve out?

  • Adjust my Dockerfile accordingly?

  • Switch to the Railway Static project type instead of a container?

Any advice or examples would be appreciated!

Thanks

$10 Bounty

1 Replies

alex-delia
PRO

9 days ago

You should be able to deploy a static site with railpack

https://railpack.com/languages/staticfile/


Deployment Crashing Due to "next start" with output: export in Next.js 14 - Railway Help Station