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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With