7

I see the above when trying to debug Node.js script with Visual Studio Code.

My launch.json looks like

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "attach",
            "name": "Attach to Process",
            "protocol": "legacy",
            "processId": "${command:PickProcess}"
        }
    ]
}

No matter I put the line "protocol": "legacy", or not I get exactly the same error as above. My environment System: OSX Node: v8.6.0 VSC: 1.17.2 Also, I run the node script with PM2.

Any suggestion would be hugely appreciated

Community
  • 1
  • 1
Adam Bubela
  • 9,433
  • 4
  • 27
  • 31
  • Can you try starting the process with --debug or --debug-brk switch ? – Akhil Oct 23 '17 at 16:53
  • @Akhil I've tried `>pm2 reload ecosystem.config.js --debug` which returned `error: unknown option `--debug'` – Adam Bubela Oct 23 '17 at 20:00
  • Not familiar with PM2 but with nodemon something like this works for me - "start": "nodemon --debug=5001 app.js", you can try using nodemon for the dev environment and see if it works for you – Akhil Oct 23 '17 at 20:05
  • Also, take a look here https://stackoverflow.com/questions/29900253/debug-application-which-is-run-using-pm2 – Akhil Oct 23 '17 at 20:08

2 Answers2

7

Node v8.6 does not support "legacy" protocol. You should use the "inspector" protocol.

Eugene
  • 9,242
  • 2
  • 30
  • 29
1

I ran above the same issue using the "legacy" protocol while running the Hello World Extension. After searching a bit, I stumbled on this issue, and change my launch.json file to the following as suggested by @weinand:

{
        "name": "Launch Extension",
        "type": "extensionHost", 
        "request": "launch",
        "runtimeExecutable": "${execPath}",
        "args": [ "--extensionDevelopmentPath=${workspaceRoot}" ],
        "outFiles": [ "${workspaceRoot}/out/src/**/*.js" ]
}
  • using node 8.9.1
  • used the latest version of the yeoman generator for the code.
glls
  • 2,325
  • 1
  • 22
  • 39