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
See to enable clustering:
pm2 start npm --name "AppName" -i 0 -- run start
What do you think?
Unfortunately, it seems that pm2 doesn't support the exact functionality you requested https://github.com/Unitech/PM2/issues/1317.
The alternative proposed is to use a ecosystem.json
file Getting started with deployment which could include setups for production and dev environments. However, this is still using npm start
to bootstrap your app.
Yes. Use pm2 start npm --no-automation --name {app name} -- run {script name}
. It works. The --no-automation
flag is there because without it PM2 will not restart your app when it crashes.
Yes we can, now pm2 support npm start, --name to species app name.
pm2 start npm --name "app" -- start
pm2 start ./bin/www
can running
if you wanna multiple server deploy you can do that. instead of pm2 start npm -- start
Now, You can use after:
pm2 start npm -- start
Follow by https://github.com/Unitech/pm2/issues/1317#issuecomment-220955319