Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 484
Prem Avatar asked Dec 05 '22 00:12

Prem


1 Answers

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.

like image 76
Umayr Avatar answered Dec 28 '22 19:12

Umayr