简体   繁体   中英

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

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

By following your tips, I tried brew info node , and i found that the nodejs@11.5.0 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 node s(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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM