node.js – nodeJs installation on Ubuntu

Question:

In ubuntus the Node.JS package was renamed to nodejs because there was already another node package.

How do I make npm understand that nodejs is already installed on the system, but the name is different?

I have got the error:

sh: 1: node: not found

npm WARN This failure might be due to the use of legacy binary "node"

Answer:

[TL;DR]

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

Probably when you installed nodejs from the apt-get installer, node was still a version earlier than 0.10.x, to solve quickly run the command above, which just creates a symbolic link.

You can also (if you want/can take the risk) try to reinstall everything to try a more updated version:

$ sudo apt-get purge nodejs
$ sudo apt-get update
$ sudo apt-get install nodejs
$ sudo apt-get install npm
Scroll to Top