Visual Studio Code to use node version specified by NVM

后端 未结 17 1230
渐次进展
渐次进展 2020-12-07 16:01

Is it possible for VS Code to use node version specified by NVM?

I have 6.9.2 installed locally. Even after switching to another version, from the OS X terminal (no

17条回答
  •  悲&欢浪女
    2020-12-07 17:01

    Some of the answers provided are correct and upvoted, but somewhat incomplete. This procedure worked for me:

    1. Open the terminal window inside VS Code and run node -v. You'll get for instance v10.12.0.
    2. Open a terminal window outside VS Code Change your node version with nvm (ie. nvm use v12.14.0)
    3. Cmd+ Shift + p and choose Preferences > Open Settings (JSON)
    4. Add "terminal.integrated.shellArgs.osx": [] to your user config
    5. Cmd+ Shift + p and choose Shell Command: Install 'code' command in PATH
    6. Close VS Code.
    7. Open a terminal window and run code. This will open VS Code with a new and updated bash / zsh session.
    8. Open the terminal window inside VS Code and run node -v. You'll get v12.14.0.

    Bonus: If you always want to get a particular node version on VS Code's terminal, set it as default by opening a terminal window outside VS Code and running:

    nvm alias default v12.14.0
    

提交回复
热议问题