Adding a permanent value to $PATH on Raspbian
You should add an absolute path, not a relative one. You added this to your path: node-v0.10.24-linux-arm-armv6j-vfp-hard/bin
. That's a relative path, not an absolute one (absolute paths start with a /
). You can change your line to:
PATH=$PATH:DIR/node-v0.10.24-linux-arm-armv6j-vfp-hard/bin
where DIR
is the full path of the directory containing node-v0.10.24-linux-arm-armv6j-vfp-hard
.
It's probably a good idea for you to read a bit on how this all works - it's not that complicated once you see it explained. See https://superuser.com/questions/238987/how-does-unix-search-for-executable-files for an example.
Ben Avnon
Updated on June 04, 2022Comments
-
Ben Avnon almost 2 years
I am quite new to Linux so I'm sorry for my newbie question, but for about and hour now I'm trying to add Node.js to $PATH with no luck :(
I've used the following line to add Node
PATH=$PATH:node-v0.10.24-linux-arm-armv6j-vfp-hard/bin
it worked, but when I logged off the terminal and logged in again, the path disappeared.
Later I tried adding the same line to
.profile
,.logins.defs
and.bashrc
. All didn't work so I removed the line.Please help me with this!
P.S , when I added the line to
.profile
I was able to call Node, but when I changed my directory in order to navigate to a Node project directory, I received the following error:-bash: node-v0.10.24-linux-arm-armv6j-vfp-hard/bin/node: No such file or directory
-
Ben Avnon over 9 yearsWorked! I added /home/pi to the start of the path and it works like a charm! Thanks allot!
-
Jordan Samuels over 9 years@BenAvnon Glad to help. If you feel it (or any other answer) adequately answered your question, please don't forget to mark it as accepted. See also How does accepting an answer work?.
-
SDsolar over 7 yearsGlad this worked, but realize this is a specific solution for just the login name pi. To make it more generic, please see my answer regarding the utilization of the $HOME variable in .profile. It provides a way the .profile can simply be copied or this section cut&pasted to other logins that have Node installed - with no editing required.