PM2 ( Process Manager for NodeJS ) Cheatsheet

615




PM2 is a popular NodeJS process manager that will help you run your NodeJS application in production

Installation

npm install pm2 -g

Starting application

You can start the application ( let's say your starting point is app.js ) using following command

pm2 start app.js

Following are some of the options you can use along with it

OptionDescription
--nameSpecifying the app with a name, helps to look after it later
--watchapplication will restart on file changes

Managing processes

Restarting the application

pm2 restart app_name/app_id

Stopping the application

pm2 stop app_name/app_id

Deleting the application

pm2 delete app_name/app_id