Closed lautiamkok closed 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.
@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?
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.
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!
Try run DEBUG=* pm2 list
and paste the result here between `
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?
could you share your system/node/pm2 versions ?
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
For pm2 : pm2 -version
, for other version please search on google how to get these.
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
@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.
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!
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.
This fixed it for us
sudo chown $USER /usr/local/lib/node_modules/pm2 -R
ensure current user have sudo permission
sometimes it also means the disk is full
It worked, thanks patrickd
Cross check the disk space of your server, I had the disk space issue, after removing the unwanted files it got solved
Try to remove /home/tealou/.pm2 and start again
I've been following this, but still not solved. Anyone can help? stackoverflow
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.
@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
same issue here with Windows Environment, any solution?
same issue! same environment as @liamomg
same as @liamomg, but pm2@3.2.2 works for me
I also used snap on ubuntu to install node and got this issue, any news? PM2 3.5.1 has still this issue
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.
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.
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!
why? [PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
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.
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
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.
Install nodejs by NVM
if you have permission errors
Just got this error in a new server because I installed node through snap. Installing it manually resolved the issue.
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.
sudo snap refresh node --channel=15
it solved my issue
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.
just run the terminal as an administrator
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.
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.
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:
pub.sock
and rpc.sock
(e.g touch pub.sock
) manually when I see the error axon:sock Got error while trying to bind Error: listen EACCES: permission denied /var/www/pub.sock
from pm2.log
DEBUG=* pm2 ls
, it makes the CPU over 100% by writting pm2.log (axon:sock Got error while trying to bind Error: listen EACCES: permission denied /var/www/pub.sock
)pub.sock
and rpc.sock
manually!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????
I encountered the same issue with Node installed via Snap, so I switched to following these steps from https://github.com/nodesource/distributions
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
Solution 20-03-24 uninstall
node
if you've installed it withsnap
please install it using nvm STEPsudo 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
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!
thankyou @jhmesseroux it solved my issue
What does this mean?
My app has stopped running completely:
It seems that I am running out of space:
Does this cause any errors?