I'm a windows developer - my knowledge of Linux and RPi are fairly basic. When I log in and am in my home folder, I can enter

nodejs -v

and am shown that it is at 0.6x.

I saw that it is in /usr/bin. The node package manager, npm, is also in this folder, and is displayed:

npm -> ../share/npm/bin/npm-cli.js

To get a newer version I followed the example at adafruit, which brought down and installed the 0.12.x version - so far so good.

However, when I enter node from the command line, I get a

no such file

message. It is in /usr/local/bin. If I go there, it runs from the command line - so I suspect it is some sort of pathing issue. Is this solved by adding the directory to .profile?

Since node and nodejs have different names I don't forsee a conflict. However, the npm in /usr/local/bin - the one I want to use - points to

npm -> ../lib/node_modules/npm/bin/npm-cli.js

So, I am hoping someone can tell me the cleanest way for:

  1. node to be executable from the command line when pointing to a location other than /local/usr/bin
  2. npm, when executed from the command line, to use the version in /usr/local/bin

1 Answer 1


You need to add /usr/local/bin to your PATH environment variable, in .profile:


However, the SHELL will use the first binary that it finds (when searching through the paths in the PATH environment variable, so if you put /usr/local/bin at the start, like so


then it will execute binaries, of the same name, which are in /usr/local/bin in preference to those in /usr/bin, for example.

If you modify your .profile (or .bashrc) and then save it, re-source it with . .profile, and then type echo $PATH, to confirm that your path has been changed.

If I understand correctly, as both of the binaries that you want to use are in /usr/local/bin, then this should fix your problem.

NOTE: The fact that they are links to other locations does not matter, in this case, as neither of them point to /usr/bin, or any other directory in your path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.