n: Cannot switch node versions?

$> node -v
v5.7.1
$> sudo n latest
     install : node-v6.8.0
       mkdir : /usr/local/n/versions/node/6.8.0
       fetch : https://nodejs.org/dist/v6.8.0/node-v6.8.0-linux-x64.tar.gz
######################################################################## 100,0%
   installed : v6.8.0
$> node -v
v5.7.1
$> n
ο node/6.8.0
$> node -v
v5.7.1

What do I do wrong? How can I switch to node v6 ?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 28
  • Comments: 21

Most upvoted comments

I’m having the same issue on Ubuntu 16.04. PS. fixed: closing and reopening the shell I’ve found the new node version.

My issue was I already had node installed via brew. Removing that helped

brew remove node

In my case … somehow there was nvm installed as well. removing nvm (rm -rf ~/.nvm) fixed it

Adding sudo works for me. (on ubuntu 16.04)

sudo n 10.4.0 etc.

My issue was I already had node installed via brew. Removing that helped

This was also my issue after updating to M1 and macOS Monterrey. Apparently n still uses /usr/local/bin/node in my case, not /opt/homebrew/bin/node. So I just brew remove node && brew reinstall n && n 12 and node --version output:

❯ n 12
   installed : v12.22.7

❯ node --version
v12.22.7

~
❯ which node
/usr/local/bin/node

❯ brew --version
Homebrew 3.3.1
Homebrew/homebrew-core (git revision 2a60185eb7e; last commit 2021-10-28)
Homebrew/homebrew-cask (git revision 88a43431b8; last commit 2021-10-28

Same - opening a new shell fixed this issue. Running Ubuntu Mate 16.04 on Raspberry Pi 3.

I’m using an ARM-based system, and which is solved after ssh reconnecting.