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

前端 未结 10 799
囚心锁ツ
囚心锁ツ 2020-12-08 01:29

Working with the new VSCode editor on a node.js project. I am attempting to configure my \"Launch\" profile for debugging by editing the launch.json file. I need to setup a

10条回答
  •  轮回少年
    2020-12-08 01:58

    On june 2020 this is still very misleading and broken on OSX Catalina 10.15.5. I am using VSCode insiders with CodeLLDB extension version 1.5.3:

    Version: 1.47.0-insider
    Commit: 0913b1aa43191d8af0ccb4a133d9a8d7c1a81d69
    Date: 2020-06-23T09:38:28.751Z (1 day ago)
    Electron: 8.3.3
    Chrome: 80.0.3987.165
    Node.js: 12.13.0
    V8: 8.0.426.27-electron.0
    OS: Darwin x64 19.5.0
    

    When launching the debugger with the env keyword on launch.json I get this:

    So in a nutshell, using "env" directive in launch.json will show up the message in the screenshot. This will prevent running the debugger, surprising lacking feature, but fair enough.

    But then, using environment instead of env, there's no error message popping up but the environment variables are not available on the runtime being debugged, so getenv(whatever) does not return the actual value for that key :-!

提交回复
热议问题