I use PM2 to run my node processes in production (on Ubuntu 14.04). After upgrading from node 0.12.x to nodejs 4.4.x, the command to run node(js) changed from node
to nodejs
. I followed the instructions on the nodesource distribution installation instructions.
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
PM2 still wants to call node
, even though the newer version uses the command nodejs
. I hacked it by replacing the node binary with a sim link like this:
mv /opt/bitnami/nodejs/bin/node /opt/bitnami/nodejs/bin/node.old
ln -s /usr/bin/nodejs /opt/bitnami/nodejs/bin/node
and this seems to work fine. But would prefer to simply change a config in PM2 to point to the new binary.
What is the best way to make pm2 compatible with an upgrade to nodejs 4.4.x?
Update: these are the places where node
exists on this server
root@ip-172-30-1-190:/usr/bin# find / -name "node" -type f
/opt/bitnami/nodejs/bin/node
/var/lib/dpkg/alternatives/node
/usr/local/bin/node
/usr/local/n/versions/node/4.4.1/bin/node
I originally tried to upgrade node using npm and the n
package using this tutorial, which accounts for the /usr/local/n/versions/node/4.4.1/bin/node
line.