I’m using PM2 to run my Next.js app on a custom port and I want to keep the command generic.
sudo pm2 start npm --name <your-app-name> -- start -- -p <your-port>
<your-app-name>
: the name you want PM2 to use for the process<your-port>
: the port number your app should listen onJust replace those two placeholders with your own values.