$> 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 ?
@khelle What does which -a node give you?
I fixed the problem by manually removing the symlink and creating a new pointing to the n node's location.
same error
$ which -a node
/usr/local/bin/node
/usr/bin/node
@khelle can you explain in more detail?
i have such a symlink:
ls -la /usr/local/bin
n -> ../lib/node_modules/n/bin/n
so you removed that and replaced it with something pointed to the node binary, not the n script?
I'm having the same issue on Ubuntu 16.04.
PS. fixed: closing and reopening the shell I've found the new node version.
I'm using arm system after ssh reconnect solved.
@roccomuso thanks that helps
Same - opening a new shell fixed this issue. Running Ubuntu Mate 16.04 on Raspberry Pi 3.
It might help to remove the pre-installed version of node:
sudo apt remove nodejs
Adding sudo works for me. (on ubuntu 16.04)
sudo n 10.4.0 etc.
I have added additional logging in v5.0.0 which should make PATH issues easier to identify.
Leaving this issue open for now since it includes the suggestion to reopen shell which has helped a lot of people: https://github.com/tj/n/issues/381#issuecomment-271722736
Much improved error messages in v6: https://github.com/tj/n/releases/tag/v6.0.0
n v6.1.2 has additional output for the situation when node command location changes, and the old location may be remembered by the current shell.
e.g.
Note: the node command changed location and the old location may be remembered in your current shell.
old : /usr/bin/node
new : /usr/local/bin/node
To reset the command location hash either start a new shell, or execute PATH="$PATH"
(Longer transcript: https://github.com/tj/n/issues/588#issuecomment-554601529)
In my case, I forgot I also installed nvm.
I use which -a node found out
and then I just nvm use 12.11.0
Most helpful comment
I'm having the same issue on Ubuntu 16.04.
PS. fixed: closing and reopening the shell I've found the new node version.