pm2 icon indicating copy to clipboard operation
pm2 copied to clipboard

PM2 unable to spawn daemon with Node.js snap installation

Open vishnu-dev opened this issue 6 years ago • 12 comments

What's going wrong?

I have installed Node.js via snap

node --version
v8.16.0

I installed pm2 via npm

sudo npm i -g pm2

For any command I run with pm2(even for sudo pm2 --version), I get this

[PM2] Spawning PM2 daemon with pm2_home=/home/vishnudev/.pm2

How could we reproduce this issue?

Install Node.js provided by snap and then install pm2 using npm. You'll head straight to this issue.

sudo snap install node --channel=10/stable --classic
sudo npm i -g pm2
sudo pm2 --version
[PM2] Spawning PM2 daemon with pm2_home=/home/vishnudev/.pm2

Supporting information

$ sudo pm2 report
[PM2] Spawning PM2 daemon with pm2_home=/home/vishnudev/.pm2

vishnu-dev avatar May 27 '19 06:05 vishnu-dev

Same. Any news on this?

Bleuzen avatar Aug 25 '19 12:08 Bleuzen

Same. In my case it's Ubuntu 18.04.4 (LXD container), node 13.8.0, PM2 4.0.0. PM2 CLI exit code is 0.

On pm2 ping followed by ps -aef --forest I see many processes of /snap/node/2598/bin/node /usr/local/lib/node_modules/pm2/lib/Sysinfo/SystemInfo.js that keep spawning, hanging and accumulating (more and more spawn indefinitely), I have to result to killing them manually. One tree example is:

root      4020     1  0 12:50 ?        00:00:00 /snap/node/2598/bin/node /usr/local/lib/node_modules/pm2/lib/Sysinfo/SystemInfo.js
root      8993  4020  0 12:50 ?        00:00:00  \_ /bin/sh -c ping -c 2 -w 3 8.8.8.8 | grep rtt
root      8994  8993  0 12:50 ?        00:00:00      \_ ping -c 2 -w 3 8.8.8.8
root      8995  8993  0 12:50 ?        00:00:00      \_ grep rtt

(tried running ping -c 2 -w 3 8.8.8.8 | grep rtt myself, looked like it worked fine).

Thanks.

gilad905 avatar Feb 12 '20 12:02 gilad905

And if you look at journalctl -f you will see it spammed with this

ghost avatar Mar 04 '20 20:03 ghost

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 23 '20 19:05 stale[bot]

Have same issue, any news?

IldarFarh avatar May 25 '20 10:05 IldarFarh

For people still having problems, the workaround was to uninstall the snap version of node and then follow instructions here https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions-1 Then installing pm2 and using it works fine.

vishnu-dev avatar Jun 13 '20 08:06 vishnu-dev

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 13 '20 09:07 stale[bot]

Issue still exists!

ghost avatar Jul 13 '20 19:07 ghost

Issue still exists!

n3xpect avatar May 09 '22 08:05 n3xpect

looks like nobody cares as you can install node outside of snap

demosglok avatar Feb 02 '23 01:02 demosglok

Any fix ? facing same.

santoshe61 avatar Oct 09 '23 15:10 santoshe61