Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Cannot connect to runtime; make sure that runtime is in 'legacy' debug mode

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

like image 886
Adam Bubela Avatar asked Oct 23 '17 16:10

Adam Bubela


2 Answers

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

like image 180
Eugene Avatar answered Nov 01 '22 10:11

Eugene


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.
like image 1
glls Avatar answered Nov 01 '22 08:11

glls