【问题标题】:VScode debugger not stopping on breakpoints while debugging a remote node server调试远程节点服务器时,VScode 调试器不会在断点处停止
【发布时间】:2019-04-11 08:51:23
【问题描述】:

我正在尝试通过 VSCode 调试我的远程节点服务器,它不会在我配置的任何断点处停止。

我在我的 mac 上运行 VSCode,我有一个节点项目的副本,我在远程计算机上有同一个节点项目的另一个副本,节点项目的两个副本都是同步的。

我正在使用以下命令在远程机器上运行节点服务器:

sudo node --inspect=5858 app.js

我的 VSCode launch.json 配置如下:

{   
    "name": "Attach",
    "type": "node",
    "request": "attach",
    "port": 5858,
    "address": "remote server addr",
    "localRoot": "${workspaceFolder}",
    "remoteRoot": "the path to project directory on remote server",
    "protocol": "auto"
}

当我在 VSCode 上启动调试器时,它似乎连接到远程服务器,但它不会在我的任何断点处停止。

VSCode 版本为 1.28.1

节点版本为 9.11.2

我错过了什么?

【问题讨论】:

    标签: node.js visual-studio-code vscode-debugger


    【解决方案1】:

    我找到了我的问题的解决方案,我缺少的配置是 server=4771

    当我按如下方式运行我的应用程序时:

    sudo node --inspect=5858 app.js server=4771
    

    VSCode 调试器能够调试我的远程节点服务器,这里提到了更多细节:https://code.visualstudio.com/docs/extensions/example-debuggers

    【讨论】:

      猜你喜欢
      • 2021-04-16
      • 1970-01-01
      • 2023-03-12
      • 2020-08-20
      • 2013-09-26
      • 1970-01-01
      • 1970-01-01
      • 2015-06-30
      • 2010-11-25
      相关资源
      最近更新 更多