Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typing node looks in /usr/sbin/node instead of /usr/bin/node

Tags:

bash

node.js

unix

I installed nodejs and then node using aptitude. After that I purged node and created a link from /usr/bin/nodejs to /usr/bin/node. Now, when I typed node, for some unknown reason it keeps looking in sbin instead of bin. To check I purged nodejs too and typed both node and nodejs and following is the output.

(mvenv)username@mymachine:~$ node
-bash: /usr/sbin/node: No such file or directory
(mvenv)username@mymachine:~$ nodejs
-bash: /usr/bin/nodejs: No such file or directory

Any explanation why typing node makes bash to look inside sbin instead of bin whereas for a similar command nodejs it looks in bin? And how can I possibly break this sbin link and restore to bin?

like image 469
Sidmeister Avatar asked Jan 17 '26 06:01

Sidmeister


1 Answers

All I needed to do was rehash. So, typing the following solved it.

$ hash -r

Thanks Etan Reisner for this too. It deletes missing links.

$ hash -d node nodejs
like image 174
Sidmeister Avatar answered Jan 19 '26 20:01

Sidmeister



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!