PM2 unable to spawn daemon with Node.js snap installation
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
Same. Any news on this?
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.
And if you look at journalctl -f you will see it spammed with this
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.
Have same issue, any news?
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.
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.
Issue still exists!
Issue still exists!
looks like nobody cares as you can install node outside of snap
Any fix ? facing same.