Set Node Runtime Version in VSCode
Issue
I have nvm installed on my Macbook Pro. Some deployed versions of my app run on Docker and on specific Node versions. I got different types of errors from packages and from Node when things weren't compiling. I wanted to force my Visual Studio Code editor to run certain versions of Node.
Method 1:
Set your nvm alias in your terminal to the Node version you want.
$nvm alias default 12
Method 2:
My preferred way of running the Node version is by adding it to my launch.json
file.
{
"version": "<some-version>",
"configurations": [
{
"type": "node",
"runtimeVersion": "12", // If i need to run node 12
"request": "launch",
"name": "Launch",
"program": "${workspaceFolder}/sample.js"
}
]}