【问题标题】:VS Code , Node Js Debugger Not working. Could Not find any debuggable targetVS Code,Node Js 调试器不工作。找不到任何可调试的目标
【发布时间】:2020-07-16 13:40:42
【问题描述】:

我正在尝试使用 Launch.json 附加到进程来调试 nodejs 代码。我试过以下配置 但调试器没有连接。我的应用程序在 Node v6.11.5 上运行

Launch.json :--

    {
        "type": "node",
        "name": "Attach by Process ID",
        "request": "attach",
        "processId": "${command:PickProcess}",
        
        "skipFiles": [
            "<node_internals>/**"
        ],
        
    }

,Error getting displayed:

【问题讨论】:

  • 你是如何启动你的节点应用程序的,你在启动前是否指定了--inspect标志?
  • 是的,我有,我正在使用 gulp start 命令启动应用程序

标签: node.js debugging visual-studio-code


【解决方案1】:

如果你正在使用 gulp,你可以使用类似这样的配置,使用 Run->Start Debugging F5 命令从 VSCode 启动 gulp 任务并直接调试它。

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "MyGulpTask",
            "type": "node",
            "request": "launch",
            "program": "${workspaceRoot}/node_modules/gulp/bin/gulp.js",
            "stopOnEntry": false,
            "args": [],
            "cwd": "${workspaceRoot}",
            "runtimeArgs": [
                "--nolazy"
            ],
            "console": "internalConsole",
        }
    ]
}

【讨论】:

    猜你喜欢
    • 2022-10-14
    • 2021-04-25
    • 2020-03-09
    • 1970-01-01
    • 1970-01-01
    • 2018-04-22
    • 1970-01-01
    • 1970-01-01
    • 2021-05-25
    相关资源
    最近更新 更多