Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

6 Answers 6

up vote 11 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 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 . – Lloyd Dewolf Mar 1 at 1:01

Late answer, but for up-to-date info...

If you install node.js using the recommend method from the node github installation readme, it suggests following the instructions on the nodesource blog article, rather than installing from the out of date apt-get repo, node.js should run using the node command, as well as the nodejs command, without having to make a new symlink.

This method from article is:

# Note the new setup script name for Node.js v0.12
curl -sL | sudo bash -

# Then install with:
sudo apt-get install -y nodejs

Note that this is for v0.12, which will get likely become outdated in the not to distant future.

Also, if you're behind a corporate proxy (like me) you'll want to add the -E option to the sudo command, to preserve the env vars required for the proxy:

curl -sL | sudo -E bash -
share|improve this answer
sudo getconf LONG_BIT
sudo uname -p
  • Confirm your CPU architecture
  • Find your node.js distribution in directory tree at (note: various versions of various node.js distributions for various CPU architectures)

My desktop is currently Ubuntu 15.10 AMD64, so I will use the following URL in my installation example (again, distrib's vary):

sudo wget

Then change directory to your download directory:

sudo cd /home/name/Downloads

From your download directory, execute the following:

sudo tar -C /usr/local --strip-components 1 -xzf node-v5.0.0-linux-x64.tar.gz

Confirm your node.js installation with the following:

sudo ls -l /usr/local/bin/node
sudo ls -l /usr/local/bin/npm


share|improve this answer
-1 Only the tar command needs sudo. – muru Nov 12 at 20:57

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.