1

I have installed nodejs on my linux terminal. On typing nodejs -v I can see the version of node, but on typing node -v the terminal returns:

bash: /usr/local/bin/node: No such file or directory

When I search the following:

which node

I get the following result:

/usr/bin/node

The command 'node' looks up in a different directory from where it actually is and this also is causing a problem while installing npm.

Please help me out.

Krishna
  • 35
  • 4
  • Try [nodejs vs node on ubuntu](https://stackoverflow.com/q/18130164/2873538) – Ajeet Shah May 15 '21 at 14:50
  • Does this answer your question? [nodejs vs node on ubuntu 12.04](https://stackoverflow.com/questions/18130164/nodejs-vs-node-on-ubuntu-12-04) – Riddhesh May 15 '21 at 16:36
  • @Riddhesh I was thrown the following error: `too many levels of symbolic links` – Krishna May 15 '21 at 19:20
  • for which command, what did you try? – Riddhesh May 15 '21 at 19:38
  • sudo ln -s /usr/bin/node /usr/local/bin/node I tried this @Riddhesh – Krishna May 16 '21 at 04:43
  • Not sure about the issue. Try out `find -L ./ -mindepth 15` (use appropriate dir) to check if there is any symlink pointing to itself. Another alternative can be that you can use [nvm](https://github.com/nvm-sh/nvm) to install node, which can handle multiple versions as well. – Riddhesh May 16 '21 at 18:11

0 Answers0