Unitech / pm2

Node.js Production Process Manager with a built-in Load Balancer.
https://pm2.keymetrics.io/docs/usage/quick-start/
Other
41.59k stars 2.62k forks source link

Spawning PM2 daemon with pm2_home=/home/tealou/.pm2 #2799

Closed lautiamkok closed 7 years ago

lautiamkok commented 7 years ago

What does this mean?

$ pm2 logs
[PM2] Spawning PM2 daemon with pm2_home=/home/tealou/.pm2

My app has stopped running completely:

This site can’t be reached

It seems that I am running out of space:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        23G   23G   43M 100% /
devtmpfs        7.9G     0  7.9G   0% /dev
tmpfs           7.EDIT:9G     0  7.9G   0% /dev/shm
tmpfs           7.9G  1.5M  7.9G   1% /run
tmpfs           7.9G     0  7.9G   0% /sys/fs/cgroup
tmpfs           1.6G     0  1.6G   0% /run/user/1002

Does this cause any errors?

vmarchaud commented 7 years ago

When launching a PM2 command and if the daemon wasn't started it will print Spawning PM2 daemon, so it means that your PM2 daemon was stopped. For diskspace, check the logs stored under ~/.pm2/pm2.log, by default they aren't rotated, check pm2-logrotate if you want to setup a rotation of logs.

lautiamkok commented 7 years ago

@vmarchaud

so it means that your PM2 daemon was stopped.

How do I start my PM2 daemon then?

What is a rotation of logs for?

vmarchaud commented 7 years ago

Its started when you run any pm2 command, thats why you getting the Spawning PM2 daemon. I let you google what is log rotation, there a lot of explanation out there.

lautiamkok commented 7 years ago

I keep getting that for whatever pm2 command that I will run, eg.:

$ pm2 list
[PM2] Spawning PM2 daemon with pm2_home=/home/tealou/.pm2

I can't go any further!

vmarchaud commented 7 years ago

Try run DEBUG=* pm2 list and paste the result here between `

lautiamkok commented 7 years ago

I got something from that:

$ DEBUG=* pm2 list
  pm2:paths pm2 home resolved to /home/tealou/.pm2 /home/tealou +0ms
  pm2:conf Using 2 parallelism (CONCURRENT_ACTIONS) +13ms
  pm2:client Using RPC file /home/tealou/.pm2/rpc.sock +225ms
  pm2:client Using PUB file /home/tealou/.pm2/pub.sock +1ms
  pm2:interface:daemon Getting interaction info +1ms
  pm2:interface:daemon [PING INTERACTOR] Trying to connect to Interactor daemon +1ms
  axon:sock connect attempt null:/home/tealou/.pm2/interactor.sock +0ms
  pm2:client [PING PM2] Trying to connect to server +9ms
  axon:sock connect attempt null:/home/tealou/.pm2/rpc.sock +6ms
  axon:sock error ENOENT +7ms
  axon:sock ignored ENOENT +0ms
  axon:sock error ECONNREFUSED +1ms
  axon:sock ignored ECONNREFUSED +0ms
  axon:sock attempting reconnect +102ms
  axon:sock closing +2ms
  axon:sock closing 0 connections +0ms
  pm2:client Daemon not launched +112ms
  axon:sock connect attempt null:/home/tealou/.pm2/rpc.sock +0ms
  axon:sock attempting reconnect +1ms
  axon:sock closing +0ms
  axon:sock closing 0 connections +0ms
  pm2:interface:daemon Interactor Daemon not launched +1ms
  axon:sock connect attempt null:/home/tealou/.pm2/interactor.sock +1ms
[PM2] Spawning PM2 daemon with pm2_home=/home/tealou/.pm2
  axon:sock error ECONNREFUSED +13ms
  axon:sock ignored ECONNREFUSED +0ms
  axon:sock error ENOENT +0ms
  axon:sock ignored ENOENT +0ms

What does this mean?

vmarchaud commented 7 years ago

could you share your system/node/pm2 versions ?

lautiamkok commented 7 years ago

yes of course I can. what command should I run to get that?

I tried:

$ pm2 --version
[PM2] Spawning PM2 daemon with pm2_home=/home/tealou/.pm2
vmarchaud commented 7 years ago

For pm2 : pm2 -version, for other version please search on google how to get these.

lautiamkok commented 7 years ago

it is the same result I get:

$ pm2 -version
[PM2] Spawning PM2 daemon with pm2_home=/home/tealou/.pm2

I just installed the latest pm2 this morning btw:

$ npm install pm2@latest -g

hpyer commented 7 years ago

@lautiamkok I got the same problem. My solution is change the owner of the folder /usr/lib/node_modules/pm2/node_modules to my current user. If this doesn't work for you, you can check the log file of ~/.pm2/pm2.log for more information.

yuguo6211 commented 7 years ago

I get the same problem with '$ pm2 list' and show 'Spawning PM2 daemon with pm2_home=/home/XXX/.pm2',bug,when I use 'sudo pm2 list' ,it`s ok!

vmarchaud commented 7 years ago

Its not a bug, the CLI try to connect to the default daemon path which is ~/.pm2/ so it depend on the user. If you want to list process that are ran under root, just run export PM2_HOME=/root/.pm2, give your user the right to read this folder/files and you'll be able to list the process that are running under root.

patrickd- commented 7 years ago

This fixed it for us

sudo chown $USER /usr/local/lib/node_modules/pm2 -R
echo-layker commented 7 years ago

ensure current user have sudo permission

scorpiozj commented 7 years ago

sometimes it also means the disk is full

bachloxo commented 6 years ago

It worked, thanks patrickd

midhunlalus commented 6 years ago

Cross check the disk space of your server, I had the disk space issue, after removing the unwanted files it got solved

sergiyvoytovych commented 6 years ago

Try to remove /home/tealou/.pm2 and start again

iqbal2929 commented 5 years ago

I've been following this, but still not solved. Anyone can help? stackoverflow

kidandcat commented 5 years ago

How did you all installed PM2?

I got this issue because in Ubuntu, I installed NodeJS with Snap. Snap jails Yarn binary and everything it installs and so PM2 hasn't permissions to spawn processes.

Unitech commented 5 years ago

@vmarchaud ;)

We’ve found and fixed an issue about the node bin path it will be shipped on next release

On Thu, Jan 3, 2019 at 9:11 PM Jairo notifications@github.com wrote:

How did you all installed PM2?

I got this issue because in Ubuntu, I installed NodeJS with Snap. Snap jails Yarn binary and everything it installs and so PM2 hasn't permissions to spawn processes.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Unitech/pm2/issues/2799#issuecomment-451262652, or mute the thread https://github.com/notifications/unsubscribe-auth/AAuP86lhjgt-kScfGV6MhBxb_jFoVhdMks5u_mP5gaJpZM4Mskec .

-- Alexandre Strzelewicz CEO and Founder at Keymetrics / PM2 https://pm2.io/ (+33) 7.83.88.11.43

ansonliam commented 5 years ago

same issue here with Windows Environment, any solution?

mattid89 commented 5 years ago

same issue! same environment as @liamomg

jimchan3301 commented 5 years ago

same as @liamomg, but pm2@3.2.2 works for me

lucafaggianelli commented 5 years ago

I also used snap on ubuntu to install node and got this issue, any news? PM2 3.5.1 has still this issue

RicardoJSTeixeira commented 5 years ago

In your pm2 folder you have pm2.log file. Mine had:

/usr/local/lib/node_modules/pm2/node_modules/chokidar/index.js:141 async remove(item) { ^^^^^^ SyntaxError: Unexpected identifier

So I switch to node v10 and it worked, so its a not compatible version with node v6 that I was using.

milnomada commented 5 years ago

Same issue here: [PM2] Spawning PM2 daemon with pm2_home=/home/...
I was using node version v6.10.3 managed with nvm. Changing the version to v10.16.0 and running command pm2 startup darwin (since I use 10.11) and it worked.

zonghua2016 commented 5 years ago

I got the same problem, i had fixed it... It's because of the version conflict Now, i use node version 6.17.1 and pm2 version 3.5.1 done!

xuqssq commented 5 years ago

why? [PM2] Spawning PM2 daemon with pm2_home=/root/.pm2

byalexandrepedrosa commented 4 years ago

Have same problem

Have tried @patrickd- solution without success.

Later, I will try @zonghua2016 solution too.

IMHO since PM2 depends node,js, should at least keep an eye on LTS releases from node and make sure still compatible with those, instead people need downgrade to versions where aparently was working, but (since is older and not more maintened) is know about unsecure issues.

penseurtank commented 4 years ago

How to overcome with PM2 issue...

I don't know, why it's showing like that... after updating PM2 I getting below one...

root@penseurtank# pm2 list [PM2] Spawning PM2 daemon with pm2_home=/root/.pm2

davedbase commented 4 years ago

Just ran into the same issue. Current node version is 6.9.1 and I tried to destroy and rebuild the service but ran into the same exact spawn issues. In the ended I ended up doing the following:

npm uninstall -g pm2
npm install pm2@3.5.1
pm2 list

Basically removes the current version and reinstalls 3.5.1 which seems most compatible with the server's node version. If you're not in root user make sure you add sudo to the cmds.

haxinc commented 4 years ago

Install nodejs by NVM if you have permission errors

natanaelsimoes commented 3 years ago

Just got this error in a new server because I installed node through snap. Installing it manually resolved the issue.

certhealth commented 3 years ago

Just got this error in a new server because I installed node through snap. Installing it manually resolved the issue.

I can also confim this.

KerimCETINBAS commented 3 years ago

sudo snap refresh node --channel=15

it solved my issue

www-chique commented 2 years ago

same issue here with Windows Environment, any solution?

I had the same issue. Then I ran the terminal as an administrator, and used pm2 ls, or pm2 start.. And that worked.

Manoj0718 commented 2 years ago

just run the terminal as an administrator

Miguelmalaj commented 2 years ago

i had the same problem and I stoped all of services of the enterprise where I work. I could solve the problem updating the node version. i use windows 7 and it is necessary to use only node versions between Node.js 13.14.0 and 13.0.0. I was using node 13,6 when i had the issue, and upgrated to node 13.14, then pm2 worked perfectly. Note: when uninstalled node, also i had to remove folder npm and npm cache. Greetings.

hgc81538 commented 1 year ago

I also have this issue. Checked that it is caused by nodejs being installed by snap. Removing nodejs from snap and following the installation steps from https://github.com/nodesource/distributions to install nodejs. Then solved.

erkhembayar-gantulga commented 1 year ago

In my case, directory permission wasn't defined correctly for customized PM2_HOME setting

I changed pm2_home as follows:

# ~/.bashrc
export PM2_HOME="/var/www"

The problem was that the current user has no permission to write on /var/www directory. So I changed the directory permission in order to fix it.

Tips:

viveksdll commented 1 year ago

Getting the the same error [PM2] Spawning PM2 daemon with pm2_home=/home/ubuntu/.pm2 even if i changed the owner ship of " sudo chown $USER /usr/local/lib/node_modules/pm2 -R" How to solve this????

cryvirus commented 9 months ago

I encountered the same issue with Node installed via Snap, so I switched to following these steps from https://github.com/nodesource/distributions

jhmesseroux commented 8 months ago

Solution 20-03-24 uninstall node if you've installed it with snap please install it using nvm STEP sudo apt install curl -y curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash source ~/.bashrc nvm install --lts nvm alias default 18.18.2 work for me and should work for you too

knatnaela commented 8 months ago

Solution 20-03-24 uninstall node if you've installed it with snap please install it using nvm STEP sudo apt install curl -y curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash source ~/.bashrc nvm install --lts nvm alias default 18.18.2 work for me and should work for you too

Only this step worked on 2024 Thanks

dev-garcia commented 4 months ago

Tentei muitas coisas, a solução foi remover o node que instalei com snap e instalar o node com o tutorial: https://nodejs.org/en/download/package-manager

Passo a passo do link, nele lista os seguintes comandos:

installs nvm (Node Version Manager) curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

download and install Node.js (you may need to restart the terminal) nvm install 20

verifies the right Node.js version is in the environment node -v

verifies the right NPM version is in the environment npm -v

Após esses passos o comando pm2 já começou a funcionar sem erros!

thxrhmn commented 2 months ago

thankyou @jhmesseroux it solved my issue