You can simply install the pm2
package.
npm install pm2 -g
Run the module that has your server
pm2 start app.js
If the above things are working fine, it shows your installation and configuration are correct. Now, use pm2
commands:
pm2 startup
follow the command from the o/p of above command
pm2 save
It seems you are using windows, you should use these steps:
- download the
pm2-installer
from here.
- Copy the entire pm2-installer directory onto the target machine, then run:
npm run setup
- On Windows, the setup script assumes you have already configured npm to use prefix and cache directories in a location accessible to the Local Service user. If not, it will issue a warning and ask if you're sure you'd like to proceed. To set up npm automatically, run configure first:
npm run configure
npm run setup
Check here for more details.