Ubuntu repo "nodejs" require symlink to "node" to use Forever?

Posted July 24, 2014 86.5k views

Ubuntu 14.04 x64

I follow the instructions here [ ] and ran the following commands;
$ sudo apt-get update
$ sudo apt-get install nodejs
$ sudo apt-get install npm

“Because of a conflict with another package, the executable from the Ubuntu repositories is called *nodejs** instead of node. Keep this in mind as you are running software.”*

user@xxx:~ $ node –version
*The program ‘node’ can be found in the following packages:

  • node
  • nodejs-legacy Ask your administrator to install one of them*

user@xxx:~ $ nodejs –version

I then installed forever;
$ sudo npm install -g flatiron
$ sudo npm install -g forever

user@xxx:~ $ forever –help
/usr/bin/env: node: No such file or directory

I read the info here [ ] but it makes no mention of needing to create a symlink and always refers to the executable as [ $ node ]

I assume that [ $ forever ] is looking for [ $ node ] and can not find it. Do I need to create a symlink to direct [ $ node ] to [ $ nodejs ]?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
5 answers

You can create a link, it would work just fine:

sudo ln -s "$(which nodejs)" /usr/bin/node

I fired up a VPS yesterday with ubuntu and nodejs using these commands:

sudo apt-get update
sudo apt-get --yes --force-yes install git
sudo apt-get --yes --force-yes install build-essential openssl libssl-dev pkg-config
tar zxvf node-v0.10.31.tar.gz
cd node-v0.10.31
sudo ./configure
sudo make
sudo make install
sudo npm install -g forever
sudo rm -rf ~/.npm

Hope that helps..

Yes. I think you can remove the nodejs package you installed using apt-get, then just create a symbolic link. When you ran $ sudo apt-get install npm it already added nodejs. The only thing messing up the system is the package name, which can be corrected by adding the following symbolic link.

ln -s /usr/bin/nodejs /usr/bin/node

I had the same trouble also i was unable to use forever command because of it, thanks for the answer!

wrong question. See post of jellobird at stackoverflow how to fix this