After updating Node.js from v10.16 to v10.32, PM2 was not detected, however it was running fine when checked with ps aux. Even upon system reboot PM2 functioned correctly even though manual PM2 commands resulted in following type of error.
pm2 list pm2: command not found
Switching Node.js back to 10.16 and PM2 commands were again available. fyi PM2 was initially installed under v10.16.
While in v10.32 tried PM2 install command npm install pm2 -g but had to use command npm install pm2 -g --unsafe-perm to get operational.
Node.js v10.16 now runs PM2 v10.1. Node.js v10.32 now runs PM2 v10.8.
Is this the proper method to keep PM2 versions in sync and working with Node upgrades/changes? Does this need to occur after installing every new version of Node?
When you switch node versions, you also switch the packages, so you need to reinstall pm2 on node update. Fortunately this does not happen very often.
You could make a shell sript to do both in one go.
For the unsafe-perm thing, it comes only if you install pm2 as root. It makes sense when you think that pm2 has quite a lot of control over your machine's processes.