Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have two Ubuntu 12.10 machines: machine A is a VMWare VM and machine B is and old Acer laptop. On both machines, I installed node using apt-get. However machine A installs the main binary as /usr/bin/node and machine B as /usr/bin/nodejs. Here are some behaviors I observed:

  1. Both machine returns /usr/bin/node in response to the which node command. However, there is no such file on machine B.
  2. Issuing the command node works for machine A, not B. On B, I have to use nodejs instead.
  3. On B, there is a binary called /sbin/node, A does not have it.

These behaviors causes inconsistency problem when developing on both machines. For now, I worked around by renaming the binaries on B as such:

sudo mv /sbin/node /sbin/node-sbin
sudo ln -s /usr/bin/nodejs /usr/bin/node

Is there a way to really fix this, so that node will be installed as /usr/bin/node instead of /usr/bin/nodejs?

share|improve this question

4 Answers 4

up vote 7 down vote accepted

On Ubuntu 13.10 all answers above did not work for me. It finally worked when I installed nodejs-legacy

sudo apt-get install nodejs-legacy

This correctly provided /usr/bin/node for me, so that e. g. nodemon can be used.

share|improve this answer
This is it. Thank you. –  Hai Vu Mar 29 '14 at 21:31
Any idea why we need to install this? Does it actually creates the symlink somehow? Why did node change the name of its executable to nodejs? –  Augustin Riedinger May 30 '14 at 9:11
The name "node" conflicted with a much older program. See lists.debian.org/debian-devel-announce/2012/07/msg00002.html and Leftium's answer below. –  Robie Basak May 30 '14 at 17:02

update: modified instructions below to use the nodejs-legacy package.(more info about node-legacy)

Try completely removing the conflicting node package:

sudo apt-get --purge remove node
sudo apt-get --purge remove nodejs-legacy
sudo apt-get --purge remove nodejs

sudo apt-get install nodejs-legacy

# Confirm it worked
node --version       # v0.10.13
ls -la `which node`  # ... /usr/bin/node -> /etc/alternatives/node

This happened to me when I unwittingly installed the non-node.js node package. Although I did apt-get remove node before installing the correct nodejs package, I guess the --purge argument is required.

Background info:

There is a naming conflict with the node package (Amateur Packet Radio Node Program), and the nodejs binary has been renamed from node to nodejs. You'll need to symlink /usr/bin/node to /usr/bin/nodejs or you could uninstall the Amateur Packet Radio Node Program to avoid that conflict.

share|improve this answer
Thank you for the background info. At this point, I don't have any of these machines to try on, but I hope I can revisit some day soon. –  Hai Vu Jul 15 '13 at 15:41
This doesn't get you a /usr/bin/node in Ubuntu 13.10. @user229115's answer below works, though. –  Jim Stewart Jan 26 '14 at 7:42
So with Ubuntu 13.10 sudo apt-get install nodejs nodejs-legacy will give you the node binary as node.js But if you already installed the node (Amateur Packet Radio Node Program) you'll obviously need to remove it. –  jonasfj Feb 20 '14 at 4:03
@AugustinRiedinger: I updated my answer. I think the combination of both purging the 'misconfigured' packages and installing the nodejs-legacy package will work. –  Leftium May 30 '14 at 16:24
Thanks it is very clear. Indeed it works when installing the nodejs-lecacy package which may be only a symlink to the nodejs executable actually... –  Augustin Riedinger Jun 2 '14 at 9:01

Unfortunately for me, creating a symlink did not work. What did work for me though was creating an alias. In ~/.bashrc or ~/.bash_aliases (if ~/.bashrc loads this file), just add the following line:

alias node="nodejs"

Restart your bash session by typing bash into the console and your alias will now work.

share|improve this answer
When I created a symlink, it did not work until I started another terminal. Try restarting your terminal... or my answer that works without symlinks/aliases ^^ –  Leftium Jul 16 '13 at 22:36
@Leftium: You also need to run: source ~/.bashrc to reload the .bashrc file (if you want to avoid restarting the terminal) read more.. –  Deepak Joy Dec 12 '14 at 3:08

I think this is it:

sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10

Using Debian alternatives.

share|improve this answer
Thanks. This is the most direct way to remedy Ubuntu's decision on this matter. –  Drew Apr 18 '14 at 12:08
@drew it looks like Ubuntu followed Debian's decision on this based on the Ubuntu bug bugs.launchpad.net/ubuntu/+source/node/+bug/1030421 . –  Lloyd Dewolf Mar 1 at 1:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.