Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 使用visual studio代码调试节点8?_Node.js_Visual Studio Code - Fatal编程技术网

Node.js 使用visual studio代码调试节点8?

Node.js 使用visual studio代码调试节点8?,node.js,visual-studio-code,Node.js,Visual Studio Code,使用Visual Studio代码版本1.13.0,启动节点调试test2.js时,节点版本为0.12,配置如下,我可以调试,vscode的响应为: Debugging with legacy protocol because it was detected. 但当节点为V8.0且发出“node debug test2.js”时,调试VSCODE得到: Debugging with legacy protocol because Node.js version could not be det

使用Visual Studio代码版本1.13.0,启动节点调试test2.js时,节点版本为0.12,配置如下,我可以调试,vscode的响应为:

Debugging with legacy protocol because it was detected.
但当节点为V8.0且发出“node debug test2.js”时,调试VSCODE得到:

Debugging with legacy protocol because Node.js version could not be determined (Error: read ECONNRESET)
知道为什么吗?我正在使用“附加”,配置如下:

"version": "0.2.0",
"configurations": [
  {
    "type": "node",
    "request": "attach",
    "name": "Attach",
    "port": 5858
  }
  {
    "type": "node",
    "request": "launch",
    "name": "Launch Program",
    "program": "${file}"
  }
]
您需要使用新的“inspector”协议,如下所示:


如果仍然出现错误: 由于无法确定node.js版本,正在使用旧协议进行调试

使用以下步骤:

  • brew卸载节点
  • 重新启动计算机
  • brew安装节点

  • 它在Visual Studio代码版本1.15.1中工作;node Version 8.4.0

    使用此工具:node--inspect brk=172.17.0.2:5858 test2.jsI通过升级到最新的VScode版本解决了此问题。。。
     {
            "type": "node",
            "request": "attach",
            "name": "Attach (Inspector Protocol)",
            "port": 9229,
            "protocol": "inspector"
     }