Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nodejs vs node on ubuntu 12.04

I installed nodejs on ubuntu from instructions given here

When I write node --version in the terminal I see this :
-bash: /usr/sbin/node: No such file or directory

I can see node in the /usr/sbin/ directory, though.

Writing npm --version shows 1.3.5
Writing nodejs --version shows v0.10.15

Also, I can see node in the /usr/bin/ directory.

So, how do I get node working?

Also, If I use zsh instead of bash, then node command works.

like image 740
Jatin Avatar asked Aug 08 '13 15:08

Jatin


People also ask

What is difference between NodeJS and node?

nodejs is a modern javascript-oriented server framework typically used to provide various services and realtime applications, while node is an older framework for transmitting data packets over amateur radio.

Does Ubuntu have NodeJS?

Ubuntu 20.04 contains a version of Node. js in its default repositories that can be used to provide a consistent experience across multiple systems. At the time of writing, the version in the repositories is 10.19.

What is a node in Ubuntu?

js is a platform built on Chrome's JavaScript runtime to build fast and scalable network applications. The latest version of the Node. js PPA is maintained by its official website. This PPA​ can be added to the Ubuntu system to install Node.


1 Answers

You need to manually create a symlink /usr/bin/node. Shortcut for bash compatible shells:

sudo ln -s `which nodejs` /usr/bin/node 

Or if you use non-standard shells, just hardcode the path you find with which nodejs:

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

Later edit

I found this explanation in the link you posted

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.

Later later edit

It's been a while since I answered this. Although the solution I posted up here worked for me several times, users have reported a few more solutions within the comments:

From @user229115

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

From AskUbuntu (user leftium)

sudo apt-get --purge remove node sudo apt-get --purge remove nodejs sudo apt-get install nodejs 
like image 69
randunel Avatar answered Oct 08 '22 02:10

randunel