How do I add environment variables to launch.json in VSCode How do I add environment variables to launch.json in VSCode node.js node.js

How do I add environment variables to launch.json in VSCode


I'm successfully passing them using the env property in launch.json:

{  "version": "0.2.0",  "configurations": [    {      "type": "pwa-node",      "request": "launch",      "name": "Launch Program",      "skipFiles": [        "<node_internals>/**"      ],      "program": "${workspaceFolder}/index.js",      "env": {        "TEST_VAR": "foo"      }    }  ]}


this is working

enter image description here

just add the following

"env": { "NODE_ENV": "development" }

"configurations": [    {        "type": "node",        "request": "launch",        "name": "Launch Program", //TODO: cmd as launch program        "skipFiles": [            "<node_internals>/**"        ],        "program": "${workspaceFolder}\\index.js",        "env": {            "NODE_ENV": "development"        }    }]


There seems to be a problem with environment variables on Windows (and probably on linux). It does work on OS X. We are investigating. Expect a fix soon.

Update (June 2, 2015): Visual Studio Code 0.3.0 contains a fix for this.