Debugging node 8 with visual studio code?

Using Visual Studio Code Version 1.13.0, when running node debug test2.js, node is version 0.12 with the following configuration, I can debug and respond to vscode:

Debugging with legacy protocol because it was detected.

      

but when node V8.0 and node debug test2.js' is issued the VSCODE debug is received:

Debugging with legacy protocol because Node.js version could not be determined (Error: read ECONNRESET)

      

Any idea why? I am using "attach", the configuration is as follows:

"version": "0.2.0",
"configurations": [
  {
    "type": "node",
    "request": "attach",
    "name": "Attach",
    "port": 5858
  }
  {
    "type": "node",
    "request": "launch",
    "name": "Launch Program",
    "program": "${file}"
  }
]

      

+3


source to share


2 answers


You need to use the new "inspector" protocol as the documentation says:



 {
        "type": "node",
        "request": "attach",
        "name": "Attach (Inspector Protocol)",
        "port": 9229,
        "protocol": "inspector"
 }

      

+2


source


If you still get error: Debugging with legacy protocol as node.js version could not be determined

Use the following steps:



  • brew remove node.
  • restart.
  • brew install node.

It works in Visual Studio Code Version 1.15.1; node Version 8.4.0

-1


source







All Articles