Exception while accessing PM2 - Error: connect EACCES /home/ubuntu/.pm2/rpc.sock
I am getting the following exception while running any PM2 command (i tried list, restart all etc)
Error: connect EACCES /home/ubuntu/.pm2/rpc.sock at Object.exports._errnoException (util.js:1022:11) at exports._exceptionWithHostPort (util.js:1045:20) at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1087:14)
If you run PM2 with sudo then you need to run all subsequent commands with sudo.
Users tend to do this when they want to start the app on
80 port (though its not recommended approach)