Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code, change NodeJS version for debugger

Tags:

I want to change NodeJS version from 4.5.0 to 7.7.2 for VS Code specifically for different projects. I am using nvm on Mac, and I have two versions stated above. They are for different projects.

Even though I can change from terminal with nvm, VS Code uses default version. I need to change the default version every time and completely restart the VSCode. Is there a way to alter configuration so it picks up the version I wanted both for in-app terminal and for running project?

like image 319
msharpp Avatar asked Mar 14 '17 09:03

msharpp


People also ask

How do I change the debugger in VS Code?

Once you have your launch configuration set, start your debug session with F5. Alternatively, you can run your configuration through the Command Palette (Ctrl+Shift+P) by filtering on Debug: Select and Start Debugging or typing 'debug ' and selecting the configuration you want to debug.

How do I change the debugger in Visual Studio?

To set Visual Studio debugger options, select Tools > Options, and under Debugging select or deselect the boxes next to the General options. You can restore all default settings with Tools > Import and Export Settings > Reset all settings.


1 Answers

After VS Code 1.21, there is a better solution than the original answer.

You can set "runtimeVersion": "7.7.2" and if you have nvm/nvs installed, it will be able to find that version of Node. Details: https://code.visualstudio.com/updates/v1_21#_node-debugging

--- Original answer ---

In your launch config, you can set a path to a Node executable from nvm like this: "runtimeExecutable": "/Users/me/.nvm/versions/node/v7.7.1/bin/node"

like image 52
Rob Lourens Avatar answered Sep 29 '22 21:09

Rob Lourens