Make NextJS PRODUCTION BUILD?

Next.js can be deployed to any hosting provider that supports Node.js. Ensure your package.json has the "build" and "start" scripts:

// package.json

{
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start"
  }
}

Make sure you have the above scripts in your package.json then run the following in order

$ npm run build   // (when using pnpm => pnpm run build )
$ npm run start  // pm2 start npm --name "your-app-name" -- run start 
//(when using pnpm => pm2 start pnpm --name "your-app-name" -- run start )

npm run build followed by npm run start are the commands to prepare the build for production/deployment and run it. This Node.js server supports all Next.js features.

INSTALL PM2 – npm install -g pm2

Resources: