Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 961
Gintas_ Avatar asked Dec 17 '25 20:12

Gintas_


1 Answers

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.

like image 57
Marlon van der Linde Avatar answered Dec 20 '25 18:12

Marlon van der Linde



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!