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
A alternative solution I've found is to simply launch code from the shell after you pick your node using nvm.
You need to first open the command pallet and select "install 'code' into path".
And then launch a terminal and select your node via nvm and then launch "code".
You don't need to modify your default node version. The following example assumes that node 6 is your default version and you want VSCode to reference version 7 of node:
# open a terminal instance
nvm use 7
code . # or project folder instead of "."
# when VSCode start, you may use ctrl+` to open the integrated terminal
# then check the node version in the integrated terminal
node -v # should print 7
I had the same problem, but the above answers didn't help.
Apparently the default shellArgs
for osx are set to bash
while I'm using zsh
. I solved the problem by setting the shellArgs
in my user settings to an empty array:
"terminal.integrated.shellArgs.osx": []
I had this same issue and I found a strange workaround that may be helpful to someone else in the future.
If I do not set eslint.runtime
my system was running node v10.11.0
for eslint server, whereas I wanted it to be running v12.13.0
which I had installed and made default via nvm
.
I found that the v10 version of node was installed by brew
based on @franziga's answer but my desired version of node was installed by nvm
. So, I uninstalled v10.11.0
via brew and closed/reopened VS Code. Strangely, eslint was still reporting that it was started using v10.
I tried running a shell without any changes to my PATH
in any startup scripts, and the version of node was still correctly pointed to v12 as expected, but VS code still starts up v10 for eslint.
I'm not sure how to check the path of the executable that is being run by eslint, and if I open an integrated terminal everything works fine with the expected version of node (v12).
I found that if I set "eslint.runtime": "node"
in settings.json
that it will now use whatever version of node
was active when I opened vscode using code .
on the terminal. Just "node"
- no path.
So, your nvm is configured well, but other version of node STILL keeps taking over?
Remove all non-nvm versions of node:
brew uninstall --force node
(yarn will be fine without system node)Note: When installing/upgrading yarn, use brew install yarn --without-node
I have the same problem and I found that I have node
installed by brew
and nvm
. I uninstalled node
installed by brew
and the versions on both terminal and visual studio code are the same now.