Prem Prem - 1 year ago 192
Node.js Question

How to start the node.js application using pm2

I have installed pm2 module using the following command:

npm install pm2@latest

Then I tried to start my test application using pm2 as follows:

$ pm2 start test.js

It throws the following error:

'pm2' is not recognized as an internal or external command

Do i need to set environment variable for pm2?

Answer Source

You need to install PM2 globally via npm install --global pm2@latest and if you want to use the local version, try ./node_modules/.bin/pm2 start test.js.