I’m using Mac Big Sur. I want to downgrade the version of Node. I tried the below (installing without sudo gives me permission errors) …
$ sudo n 14.15.1
installed : v14.15.1 to /usr/local/bin/node
active : v14.17.6 at /usr/local/opt/node@14/bin/node
But I still get the current version when I check
$ node -v
v14.17.6
Fwiw, here’s what I see with “which node”
$ which node
/usr/local/opt/node@14/bin/node
Edit: My $PATH when I run 'echo $PATH' ...
/usr/local/opt/node@14/bin:/Users/davea/.rvm/gems/ruby-2.7.1/bin:/Users/davea/.rvm/gems/ruby-2.7.1@global/bin:/Users/davea/.rvm/rubies/ruby-2.7.1/bin:/usr/local/opt/node@14/bin:/Users/davea/.nvm/versions/node/v14.18.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/davea/.cabal/bin:/Users/davea/.ghcup/bin:/Users/davea/.cabal/bin:/Users/davea/.ghcup/bin:/Users/davea/.cabal/bin:/Users/davea/.ghcup/bin:/Users/davea/.rvm/bin:/Users/davea/.cabal/bin:/Users/davea/.ghcup/bin:/Users/davea/.cabal/bin:/Users/davea/.ghcup/bin:/Users/davea/.cabal/bin:/Users/davea/.ghcup/bin:/Users/davea/.rvm/bin:/Users/davea/.cabal/bin:/Users/davea/.ghcup/bin:/Users/davea/.cabal/bin:/Users/davea/.ghcup/bin:/Users/davea/.cabal/bin:/Users/davea/.ghcup/bin:/Users/davea/.rvm/bin
Edit 2: PATH vars for both regular user and sudo user ...
$ env | grep PATH
PATH=/Users/davea/.rvm/gems/ruby-2.7.1/bin:/Users/davea/.rvm/gems/ruby-2.7.1@global/bin:/Users/davea/.rvm/rubies/ruby-2.7.1/bin:/Users/davea/.nvm/versions/node/v14.18.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/davea/.cabal/bin:/Users/davea/.ghcup/bin:/Users/davea/.cabal/bin:/Users/davea/.ghcup/bin:/Users/davea/.cabal/bin:/Users/davea/.ghcup/bin:/Users/davea/.rvm/bin
$ sudo env | grep PATH
PATH=/Users/davea/.rvm/gems/ruby-2.7.1/bin:/Users/davea/.rvm/gems/ruby-2.7.1@global/bin:/Users/davea/.rvm/rubies/ruby-2.7.1/bin:/Users/davea/.nvm/versions/node/v14.18.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/davea/.cabal/bin:/Users/davea/.ghcup/bin:/Users/davea/.cabal/bin:/Users/davea/.ghcup/bin:/Users/davea/.cabal/bin:/Users/davea/.ghcup/bin:/Users/davea/.rvm/bin
The n
message is telling you that the version it just "installed" and the version that is "active" are different. You have two versions of node installed, and the active version is the one that is first in the PATH
.
The active version is /usr/local/opt/node@14/bin/node
. I don't recognise that path, not sure what was used to install that. It must be in your PATH
variable and there might be a clue in your login script as to what added /usr/local/opt/node@14/bin
to the PATH
?
To get the n
installed version of node to be the active version, you could delete the other copy of node, or put /usr/local/bin
earlier in PATH
so it is found first, or simplest remove /usr/local/opt/node@14/bin
from your PATH variable.