使用Visual Studio Code调试Node 8?

4
使用 Visual Studio Code 版本 1.13.0,当启动一个 Node 调试 test2.js 时,Node 版本为 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)

有任何想法吗?我正在使用“attach”,配置如下:
"version": "0.2.0",
"configurations": [
  {
    "type": "node",
    "request": "attach",
    "name": "Attach",
    "port": 5858
  }
  {
    "type": "node",
    "request": "launch",
    "name": "Launch Program",
    "program": "${file}"
  }
]

使用以下命令可以正常工作:node --inspect-brk=172.17.0.2:5858 test2.js - AngeloC
我通过升级到最新的VScode版本解决了这个问题... https://code.visualstudio.com/download - MTZ4
2个回答

7

根据文档所述,您需要使用新的“检查器”协议:

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

-2
如果您仍然遇到以下错误: debugging with legacy protocol because node.js version could not be determined

请按照以下步骤操作:
  1. brew uninstall node.
  2. restar computer.
  3. brew install node.

在Visual Studio Code版本1.15.1中,它适用于node版本8.4.0。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接