Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command 'pm2' not found

I recently cloned my nodejs express app on ec2 ubuntu instance. I ran npm install pm2 but it didn't have write permissions. So I ran

sudo chown _R $USER /usr/lib/node_modules

After that PM2 got installed but when I hit pm2 start app.js, it shows pm2 command not found. I have installed it globally locally but nothing works. What should I do? Check out the screenshot of ERROR

like image 550
Aman Avatar asked Mar 05 '26 15:03

Aman


1 Answers

pm2 needs to be installed globally (on the server) to function correctly.

Try

sudo npm install -g pm2

Digital Ocean has an excellent tutorial on this.

like image 89
O. Jones Avatar answered Mar 07 '26 08:03

O. Jones



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!