npm: pm2-windows-startup not working properly

Issue

I want my application to automatically restart on Windows reboot. I am using the pm2-windows-startup package provided by the npm. But, I am having an issue. When I restart the remote server and enter the pm2 list command in the cmd, it shows my application as online. However, when I hit the application’s URL in my browser, I get a This site can’t be reached error.

I have followed the instructions provided by their official documentation.

pm2-windows-startup

The only way my application runs after a restart is by using the below commands:

  • pm2 kill
  • pm2 resurrect

The server has Windows Server 2012 R2 operating system.

I don’t know why is this happening despite following all the instructions provided by the repository. Any help would be appreciated. Thanks!

Solution

You can try this other package: https://www.npmjs.com/package/pm2-windows-service

It install PM2 as a service where pm2-window-startup just wrote a startup string in registry.

If you want more informations, you have this post: Windows: Auto start PM2 and node apps

Answered By – Alaindeseine

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published