Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State is now: Stopped #69

Open
nrcionline opened this issue Jul 17, 2022 · 13 comments
Open

State is now: Stopped #69

nrcionline opened this issue Jul 17, 2022 · 13 comments

Comments

@nrcionline
Copy link

After running this on windows server 2022 (including the configure options), all I get is: State is now: Stopped printing endlessly to the powershell window. I tried to manually start the PM2 process, but it won't start.

@Dr-NULL
Copy link

Dr-NULL commented Aug 16, 2022

I have the same issue in a Windows Server 2019

@linchiyu
Copy link

Restarting the computer solved this issue for me, this problem happened after I installed pm2-installer, removed it and then installed it again

@Alynva
Copy link

Alynva commented Aug 18, 2022

Same here.

@taieb-tk
Copy link

Same here..

@Sandro-Sousa
Copy link

for those who are experiencing the problem of the service stopped, go to Services > in the Log On tab, Set as local system account.

@redevill
Copy link

redevill commented Sep 15, 2022

@Sandro-Sousa - Tried changing the service to local system account. Then the service was able to start. However after a reboot of the system, when I try to perform a pm2 list:

My understanding of the service is to provide a restart of pm2 after a reboot - currently I can't get this to work.

C:\Users\zenwa>pm2 list
connect EPERM //./pipe/rpc.sock
[PM2] Spawning PM2 daemon with pm2_home=C:\ProgramData\pm2\home
node:events:505
throw er; // Unhandled 'error' event
^

Error: connect EPERM //./pipe/rpc.sock
at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)
Emitted 'error' event on ReqSocket instance at:
at Socket. (C:\ProgramData\npm\npm\node_modules\pm2\node_modules\pm2-axon\lib\sockets\sock.js:201:49)
at Socket.emit (node:events:527:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4048,
code: 'EPERM',
syscall: 'connect',
address: '//./pipe/rpc.sock'
}

@redevill
Copy link

After reboot, if I shut the service down, and then issue the Pm2 list command manually:

C:\Users\zenwa>pm2 list
[PM2] Spawning PM2 daemon with pm2_home=C:\ProgramData\pm2\home
[PM2] PM2 Successfully daemonized

Then PM2 starts successfully without the processes...
[PM2][WARN] Current process list is not synchronized with saved list. App app differs. Type 'pm2 save' to synchronize.

At this point if I restart the service, the expected processes running under pm2 also come back.
Possibly priv issue with the service? It is unable to start / deamonize pm2? after reboot...

@Sandro-Sousa
Copy link

you need to give admin permissions to access the folder where pm2 was installed globally, follow this tutorial:https://blog.cloudboost.io/nodejs-pm2-startup-on-windows-db0906328d75

@Sandro-Sousa
Copy link

if you already have the pm2 installer disregard the last two steps about the other tools

@redevill
Copy link

redevill commented Sep 15, 2022

@Sandro-Sousa - just discovered the problem(FYI for NVM users):
I am using nvm, and was using the default location, which is user specific. Changed the nvm install location to ProgramData\nvm ... also made sure all installation was done with admin. This change allowed the service to install normally (no endless "server state") AND start normally, and to come back after reboot. The last tidbit - unless you use an admin window to do the "pm2 list" after the reboot, you still get the above error.

@SnippetsUnlimited
Copy link

SnippetsUnlimited commented Oct 12, 2022

When the PM2 service is stopped and you run the command line "pm2 start myapp", this starts the pm2 daemon. If you try to start the PM2 service while running the daemon the service would keep crashing. For Windows, you have to do the following steps in order:
1 - Restart machine.
2 - Run PM2 Windows Service through service console.
3 - Run command line "pm2 start myapp"
4 - Run command line "pm2 save"

This should start the service, register and run your app. Any further restarts should start your pm2 windows service as expected.

@DeanB2015
Copy link

DeanB2015 commented Jun 8, 2023

Adding the Local Service username to the nodejs folder > Properties > Security solved this for me. Local Service is used on my PM2 Windows Services > Properties > Log On.

@aquiab
Copy link

aquiab commented Nov 24, 2023

@Sandro-Sousa - just discovered the problem(FYI for NVM users): I am using nvm, and was using the default location, which is user specific. Changed the nvm install location to ProgramData\nvm ... also made sure all installation was done with admin. This change allowed the service to install normally (no endless "server state") AND start normally, and to come back after reboot. The last tidbit - unless you use an admin window to do the "pm2 list" after the reboot, you still get the above error.

thank you, this was the problem for me too, just reinstalled nvm to c:/program files and it worked fine 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants