[Error: Could not find a production build in the '.next' directory
yingzhox
PROOP

10 months ago

We are unable to deploy nextjs app, its under web folder of a monorepo.

$10 Bounty

2 Replies

Railway
BOT

10 months 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!


10 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 10 months ago


10 months ago

  1. Tell Railway to use web/ as your app root In your Railway project → SettingsDeploymentRoot Directory, set:
web  
  1. Set your Build & Start commands Still under Deployment, update:
Build Command: npm install && npm run build  
Start Command: npm run start  
  1. Ensure your web/package.json has the right scripts
{  
"scripts": {  
"build": "next build",  
"start": "next start"  
  }  
}  

(Railway will run those from inside web/, so it will find package.json and produce the .next folder.)

4. Redeploy

Hit Deploy (or push a dummy commit). You should see

› Building… › Production build in .next ready › Starting…  

and your app will go live.

That’s it—no extra Dockerfiles or hacks. Railway will look under web/, run npm run build, generate .next, then npm run start.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...