shearichard
shearichard

Reputation: 8372

nvm and node --version disagree?

Can anyone explain how when I do node --version I get a version of Node which doesn't appear in the output of nvm -ls ?

glaucon@polo /media/poloextra/dev/souvenir $ node --version
v7.10.0
glaucon@polo /media/poloextra/dev/souvenir $ nvm ls
         v4.2.2
         v5.5.0
         v7.7.2
         v8.0.0
->       system
default -> stable (-> v8.0.0)
node -> stable (-> v8.0.0) (default)
stable -> 8.0 (-> v8.0.0) (default)
iojs -> N/A (default)

It's a little while since I've used Node and I think perhaps I've misunderstood how nvm does what it does. I thought if there was a version of Node installed then it would appear in the nvm ls output


EDIT1 : Responding to comment the output of which -a node is :

glaucon@polo /media/poloextra/dev/souvenir $ which -a node
/usr/local/heroku/bin/node
/home/glaucon/.nvm/versions/node/v8.0.0/bin/node
/usr/local/bin/node
/usr/bin/node

Upvotes: 2

Views: 498

Answers (1)

LJHarb
LJHarb

Reputation: 39704

(nvm maintainer here) This is intentional; nvm ls (and nvm current) outputs that you're using the "system" node; which happens to be v7.10.0. If you run nvm use node, you'll use the latest nvm-installed version, which seems to be v8.0.0 (based on your nvm ls output).

You can also run nvm alias default node which will auto-use the latest version every time nvm.sh is sourced (ie, when you open your terminal).

Upvotes: 1

Related Questions