I'm trying to launch node.js application with pm2.
I've installed pm2: sudo npm install pm2 -g
Now, if I launch pm2 as non-root user it works fine.
But if I try to run: sudo pm2 logs I have an error:
pm2: command not found
pm2 logs works fine
If I use a sh-script to launch: sudo sh run.sh there is another error in logs:
events.js:72
throw er; // Unhandled 'error' event
^ Error: connect EACCES
How can I launch pm2 as super-user, to make sure that other users can launch and restart applications with sudo pm2 monit or sudo pm2 restart appname etc..?