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.
Apparently the solution differs between Ubuntu versions. Following worked for me on Ubuntu 13.10:
HTH
Edit: Rule of thumb:
If you have installed
nodejs
but are missing the/usr/bin/node
binary, then also installnodejs-legacy
. This just creates the missing softlink.According to my tests, Ubuntu 17.10 and above already have the compatibility-softlink
/usr/bin/node
in place afternodejs
is installed, sonodejs-legacy
is missing from these releases as it is no more needed.This happened to me as well.
The issue was that I had installed node from source some time ago. Running
always pointed to this local installation. Also,
pointed to the local installation.
deleting the directory with the source install didn't help. It just broke the node command. In the end, unsetting the NODE_PATH environmental variable and purging then reinstalling nodejs did the trick.
After this,
and npm install started to work for packages depending on Node => 5.0.
This works for me:
After following the instructions in this link.
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 thenodejs
command, without having to make a new symlink.This method from article is:
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 -
I had the same issue symbolic link helped me out: sudo ln -s /usr/bin/nodejs /usr/bin/node after that sudo npm install -g phantomjs-prebuilt
went smoothly
I am new to all this, but for me a simple alias worked:
at least for running things directly in bash and executing .js files.