Search code examples
node.jsgoogle-app-enginegoogle-compute-engineresetpm2

PM2 doesn't launch my nodejs app after server restart


I have a vm instance set up in Google Compute Engine. I installed pm2, ran these commands: sudo env PATH=$PATH:/usr/local/bin pm2 startup -u zgintasz

pm2 start index.js

When I type pm2 list, I then see my app process running.

I wanted to make sure my nodejs app relaunches when server is restarted, so I clicked Reset on Google Developer Console, typed in pm2 list again and I don't see it running anymore. What can be wrong?


Solution

  • I have been in the same boat. After some searching I found that you need to 'save' after starting apps. 'pm2 save' - which dumps the processes.

    This solved this issue for me personally, on my Ubuntu machine, but on my debian vps, it seems to still not persist as it should.