The knowledge sources don’t describe a case where npm run build for a Next.js app exits immediately with no output or error at all, so I can’t say with certainty what’s happening on your server.
From the available docs and issues, the only grounded guidance is:
- Confirm the build is actually failing vs. exiting with code 0
On the server, run:
npm run build; echo "exit code: $?"
If the exit code is 0, Node/Next think the build “succeeded” even though nothing was printed. If it’s non‑zero, it’s a failing build with missing logs.
The Vercel docs emphasize that when builds fail, you normally see an error line like npm run build exited with 1 and more detail above it in the logs. [Troubleshoot build]
In your case, that detail is missing, which is not covered in the docs.
- Match the environment to the working machine
The docs recommend reproducing the build in the same environment (Node version, dependencies, env vars) as production. [Troubleshoot build]
On both machines, compare:
node -v
npm -v
cat package.json | grep '"next"' -n
If versions differ, align the server to the versions that work at home and reinstall dependencies:
rm -rf node_modules package-lock.json
npm install
npm run build
- Check for TypeScript build failures (if you use TS)
Next.js will fail next build on TypeScript errors. [Disabling TS errors]
As a diagnostic (not a permanent fix), you can temporarily add to next.config.js / next.config.ts: