NextJS not starting correctly in our latest deployment

trungly
PRO

5 months ago

The latest build, which should only have mainly CSS changes since our last successful build, does not probably start up. This is the error we are getting:

Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id

    at setupFsCheck (/app/node_modules/next/dist/server/lib/router-utils/filesystem.js:151:19)

    at async initialize (/app/node_modules/next/dist/server/lib/router-server.js:62:23)

    at async Server. (/app/node_modules/next/dist/server/lib/start-server.js:249:36)

npm warn config production Use `--omit=dev` instead.

I am fairly sure we did not change any of the project & service settings either.

Did something change with Nixpacks that we're not aware of?

When running the steps locally with this same git commit, it works:
$ npm run build
$ npm run start

View Deploy details

> ⓘ Deployment information is only viewable by project members and Railway employees.

Solved

3 Replies

5 months ago

Hello,

Can you try disabling cache, set a service variable NIXPACKS_NO_CACHE to 1

Let me know if that heps!

Best,

Brody


Status changed to Awaiting User Response Railway 5 months ago


trungly
PRO

5 months ago

That worked. Thank you!


Status changed to Awaiting Railway Response Railway 5 months ago


5 months ago

Awsome!


Status changed to Awaiting User Response Railway 5 months ago


Status changed to Solved brody 5 months ago


NextJS not starting correctly in our latest deployment - Railway Help Station