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.
I think this is it:
Using Debian alternatives.
https://nodejs.org/en/download/
It's optional to remove the existing node and nodejs, but have to do alternatively install the latest 7.x nodejs.
I have the same issue in Ubuntu 14.04.
I have installed "nodejs" and it's working, but only if I'm use command "nodejs". If I try to use "node" nothing happens.
I'm fixed this problem in next way:
Install nodejs-legacy
After that, when I type "node" in command line I'm get an error message "/usr/sbin/node: No such file or directory"
Second, what I did, it's a symbolic link on "nodejs":
You need to manually create a symlink
/usr/bin/node
. Shortcut for bash compatible shells:Or if you use non-standard shells, just hardcode the path you find with
which nodejs
:Later edit
I found this explanation in the link you posted
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)
How about using the official instructions from the nodejs site:
For v7:
For v6:
For v4:
I've tested these from Windows bash (via subsystem for Linux - 14.04) and raspbian (ARM Debian based). Running
sudo apt-get install -y nodejs
without first running the setup script will result in you getting node 0.10.If you are planning on installing native npm modules requiring build, also run:
Note: this is the recommended path for any Debian based distro across all architectures.