Silo QIAN
Silo QIAN

Reputation: 60

I cannot change the nodejs version on vscode under OSX using nvm

I see in vscode terminal, my nodejs version is v11.5.0, I need to change the version to 12.13.0, and i do nvm use 12.13.0, it successfully executed, then node -v, it is still 11.5.0, as the sreenshot below.

At the /bin/bash from system, i tried node -v, it 12.13.0.

Why cannot i change the version? anyone help! thanks. you can see the nvm ls below in the screenshot.

in vscode terminal

~$ node -v
v11.5.0
~$ nvm use 12.13.0
Now using node v12.13.0 (npm v6.10.2)
~$ node -v
v11.5.0
~$ nvm ls
       v10.13.0
       v10.15.0
       v10.15.1
       v10.16.0
       v12.13.0
->       system
default -> 12.13.0 (-> v12.13.0)
system -> 12.13.0 (-> v12.13.0)
node -> stable (-> v12.13.0) (default)
stable -> 12.13 (-> v12.13.0) (default)
iojs -> N/A (default)
lts/* -> lts/erbium (-> v12.13.0)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.16.2 (-> N/A)
lts/dubnium -> v10.17.0 (-> N/A)
lts/erbium -> v12.13.0
~$ 

in iTerm

Last login: Fri Oct 25 10:49:41 on ttys000
~$ node -v
v12.13.0
~$

Thanks to @tuan-anh-tran , i try this:

in vscode terminal

~$ which node
/usr/local/bin/node

in system terminal

~$ which node
/Users/lennon/.nvm/versions/node/v12.13.0/bin/node
~$

what's wrong? Both the terminals is /bin/bash, why the node is different? is anywhere i should do some settings?

screenshot

Upvotes: 0

Views: 1351

Answers (1)

Silo QIAN
Silo QIAN

Reputation: 60

Thanks to @tuan-anh-tran again for nice helping.

By following your tips, I tried brew info node, and i found that the [email protected] is installed sometime earlier.

So that i execute brew uninstall node, and reopen vscode terminal, the version is 12.13.0, that is correct!

The problem solved, but i still do not known why the nodes(in vscode terminal and in system terminal) will point to the different program in the same terminal /bin/bash, might anywhere need to do some settings.

Upvotes: 1

Related Questions