'PM2 not accessible to other users

I have PM2 setup to run some apps on an ubuntu server. Last year I made some changes so that pm2 would run without sudo permissions, and I can't remember what I had changed.

My problem is that the pm2 instance I can access from my personal user is not the same as the one the root user sees. So pm2 list on my account will list all of my apps, but the command from the root user will just be an empty process list. So now I've hit an issue where I'm trying to create a cronjob to restart some processes, but I can't get it to run the correct pm2 instance.

So I guess my question is either how do I specify that my users pm2 instance is the one that should be run, or, how do I make pm2 globally accessable.

My PM2 home is PM2_HOME=/opt/pm2/.pm2 it may have been one of the things I messed with, but I'm not sure.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source