2

I am currently trying to start a node.js project is VSCode, and I want to set up the debugger with a launch.json file. I understand the way to do this is to go to run -> add configuration, but when I do so, there is no option to select the "Node.js" environment specifically (there is Node.js (legacy) and Node.js (preview) as shown in the screenshot attached). I'm currently on v10.15.1 (in another project I am able to debug in a 'pure' Node.js environment, where the type property of configurations in launch.json is set as "node") - is this supposed to cause issues?

enter image description here

user11508332
  • 537
  • 1
  • 11
  • 28

1 Answers1

3

this stackoverflow post can help you.

In summary, legacy and preview means old and new nodejs debugger in vscode, respectively. The following json snippets show the difference between launch.json files using the two debuggers, and only the type field differs.

    // node-preview
    "configurations": [
        {
            "type": "pwa-node", //differs
            "request": "launch",
            "name": "Launch Program",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "program": "${file}"
        }
    ]

    //node-legacy
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "program": "${file}"
        }
    ]

JW Tang
  • 79
  • 3