【问题标题】:debugging node 8 with visual studio code?使用 Visual Studio 代码调试节点 8?
【发布时间】:2017-06-14 02:56:22
【问题描述】:

使用 Visual Studio Code 版本 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)

知道为什么吗?我正在使用'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
  • 我通过升级到最新的 VScode 版本解决了这个问题...code.visualstudio.com/download

标签: node.js visual-studio-code


【解决方案1】:

您需要像documentation 所说的那样使用新的“检查器”协议:

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

【讨论】:

    【解决方案2】:

    如果您仍然收到错误: 使用旧协议进行调试,因为无法确定 node.js 版本

    使用以下步骤:

    1. brew 卸载节点。
    2. 重新启动计算机。
    3. brew 安装节点。

    它适用于 Visual Studio Code 版本 1.15.1;节点版本 8.4.0

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-18
      • 2012-09-24
      • 1970-01-01
      • 2015-08-04
      • 2011-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多