I am trying to install/ switch node version in fly using n since different build requires different version of node. n is able to download specified version but it is unable to installed to /usr/bin/node and still old version there.
05-Apr-2021 11:46:27 installed : v10.16.0 to /usr/local/bin/node
05-Apr-2021 11:46:27 active : v8.16.1 at /bin/node
when I run node --version command it returns the old version 8.16.1 apparently, n installed node to different location. is there a way to fix that? thank you in advance
/bin
, so the binary's location changed.Reset $PATH
: PATH="$PATH"
On a *NIX system, there are many binary locations: /bin
, /usr/bin
, /usr/local/bin
, or even /home/USER/.local/bin
if configured.
All the binary folders make it easier to organize.
n
change the location?To keep with standards, of course. /usr[/local]/bin
is the traditional spot for package-installed binaries.
Shells use a "hash table" so they don't need to look through the $PATH
again and again- wait, what's $PATH
?
PATH
?PATH is a :
-separated list of locations to find binaries to execute. For example, mine looks like this: /usr/local/opt/coreutils/libexec/gnubin:/home/badboyhalocat/node_installs/bin:/home/badboyhalocat/.config/yarn/global/node_modules/.bin:/home/badboyhalocat/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
The shell uses this to look up where to find the code to run.
Just reset your PATH: PATH="$PATH"