Is there a way for pm2 to run an npm start script or do you just have to run pm2 start app.js
So in development
npm start
Then in production with pm2 you would run something like
pm2 start 'npm start'
There is an equivalent way to do this in forever
:
forever start -c "npm start" ./
PM2 now supports npm start:
pm2 start npm -- start
To assign a name to the PM2 process, use the --name
option:
pm2 start npm --name "app name" -- start