Prompt Details
Model
Chat - (gpt-5.5)
Token size
610
Example input
[ERROR_MESSAGE]: Cannot find module './vendor-chunks/next.js'
[CODE_OR_LOGS]: The Next.js project builds successfully but crashes during production startup after deployment on Ubuntu using PM2.
[PROJECT_STACK]: Next.js, PM2, Ubuntu
Example output
1. Problem Summary
Your Next.js production server is failing because the app is being started with the wrong command after building with standalone output.
2. Most Likely Root Cause
The project likely has output: "standalone" enabled in next.config.js, but PM2 is starting the app with next start instead of the generated standalone server file.
3. Exact Fix
Update your PM2 configuration so it runs the standalone server file instead of the Next.js CLI.
4. Corrected Code or Configuration
module.exports = {
apps: [
{
name: "nextjs-app",
script: ".next/standalone/server.js",
instances: 1,
exec_mode: "fork",
env: {
NODE_ENV: "production",
PORT: 3001
}
}
]
};
5. Step-by-Step Fix
Run these commands:
npm install
npm run build
pm2 delete nextjs-app
pm2 start ecosystem.config.js
pm2 save
pm2 logs nextjs-app
6. Verification
Open the website in your browser and check PM2 logs. If the app starts without the standalone warning or missing module error, the issue is fixed.
7. Prevention Tip
If Next.js standalone output is enabled, always start the app using .next/standalone/server.js in production.
By purchasing this prompt, you agree to our terms of service
GPT-5.5
A powerful debugging prompt that helps developers fix frontend, backend, API, deployment, Docker, Nginx, PM2, and production errors. It analyzes code, logs, screenshots, and error messages, then gives the exact root cause, file-level fixes, line changes, and clean corrected code. Best for Next.js, React, Django, Node.js, REST APIs, and full-stack projects.
...more
Added 2 weeks ago
