I am using AWS EC2 and runing ubuntu.
I encountered a problem where pm2 showed: 'Current process list is not synchronized with the saved list. App XXX differs. Type 'pm2 save' to synchronize.
*the XXX is my app name.
In cmd, I inputted:
"sudo env PATH=$PATH:/usr/bin pm2 startup systemd -u ubuntu --hp /home/ubuntu"then, "pm2 save" again.
"sudo reboot"
All apps in pm2 startup automatically.
Maybe "pm2 startup -u ubuntu" also works too.