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?

7 Answers 7


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.

  • 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, 2013 at 15:41
  • This doesn't get you a /usr/bin/node in Ubuntu 13.10. @user229115's answer below works, though. Jan 26, 2014 at 7:42
  • 1
    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, 2014 at 4:03
  • 1
    @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, 2014 at 16:24
  • 1
    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... Jun 2, 2014 at 9:01

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.


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.

  • 2
    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, 2013 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.. Dec 12, 2014 at 3:08
  • Symlinking at a new location almost certainly needs a hash node invocation in your existing terminals, because modern shells remember the location of commands that have been previously looked up in PATH. The hash builtin command in such shells tells them to redo the lookup, and remember the new location.
    – mtraceur
    Apr 15, 2017 at 3:23

I think this is it:

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

Using Debian alternatives.


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 https://deb.nodesource.com/setup_0.12 | 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 https://deb.nodesource.com/setup_0.12 | sudo -E bash -

On ubuntu 14.04 I had the same node problem. I had not working "node", and working "nodejs". I just did

sudo apt-get remove node

and right after that, node was running, and nodejs is running too :) I'm new to linux and that is a misstery to me. However Bower is running!!!

sudo getconf LONG_BIT
sudo uname -p
  • Confirm your CPU architecture
  • Find your node.js distribution in directory tree at https://nodejs.org/dist/ (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 https://nodejs.org/dist/v5.0.0/node-v5.0.0-linux-x64.tar.gz

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

ref. http://www.hostingadvice.com/how-to/install-nodejs-ubuntu-14-04/

  • 1
    -1 Only the tar command needs sudo.
    – muru
    Nov 12, 2015 at 20:57
  • +1 Thank you very much for that better way - the best way for me! Feb 25, 2016 at 5:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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