Get Message Spawning PM2 daemon with pm2_home=<home_dir>/.pm2 always
Asked Answered
F

4

6

On ec-2 instance whenever I execute pm2 I get the message...

Spawning PM2 daemon with pm2_home=<home_dir>/.pm2

This occurs with pm2 info, pm2 list, pm2 -h etc.

A bare pm2 will show help.

I can get more response from sudo -i.

It seems something is stopping PM2 from demonising when non-sudo.

Forty answered 4/5, 2017 at 14:58 Comment(0)
N
1

This solved the problem in my case:

pm2 delete 0

I had been looking at other answers like reinstalling pm2, installing a previous version, permission issues, and none of them worked or applied to my case.

I'm not positive but I think I had a buggy process that was blocking the spawn. I had used pm2 a couple of days prior when I first logged into my server but I had been running an app that kept crashing and I tried to listen on port 80 and got permission errors. Ubuntu 18 server machine, Node 12.14.1, NPM 6.13.4, PM2 4.2.3

Nordstrom answered 2/2, 2020 at 5:47 Comment(0)
T
1

This usually means that pm2 is running under PID that differs from the one in your .pm2/pm2.pid

To exit from this situation try one of these:

pm2 kill

or

ps aux | grep pm2 and then kill -9 PID found in PM2 vX.X.X: God Daemon

if none of the above help:

pkill node && \
pm2 delete all && \
pm2 flush && \
kill -9 $(head -n 1 /home/$USER/.pm2/pm2.pid) && \
rm -rf /home/$USER/.pm2

After that run pm2 ls or whatever pm2 command you want. That should daemonize pm2 again with the correct PID in .pm2/pm2.pid

EDIT

Another possible reason could be any error during the pm2 init, so if the above doesn't work for you check .pm2/pm2.log for any errors and fix them

Titanomachy answered 9/10, 2021 at 21:17 Comment(0)
E
0

Hi I fixed this by using an older version of pm2

npm uninstall -g pm2
npm install -g [email protected]
Ehrenberg answered 9/1, 2020 at 9:15 Comment(0)
C
-1

I just set -

 pm2_home=C:\Users\<Admin/Your Account>\.pm2

in environment variables.

And then

restart your the PC / server.

Calm answered 26/4, 2020 at 10:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.