【发布时间】:2021-03-15 02:29:53
【问题描述】:
我正在使用 Visual Studio 代码在生产环境中调试节点应用程序
Node 进程在 docker 内部运行,
我端口转发并通知 USR1 以启用将调试器从 VS 代码附加到该节点进程
我的 VS Code 配置是这样的
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Debug: service",
"sourceMaps": true,
"smartStep": true,
"remoteRoot": "/src/",
"localRoot": "/home/my-username/work/orders/src/",
"protocol": "inspector",
"port": 9229,
"restart": true,
"address": "0.0.0.0",
"skipFiles": [
"<node_internals>/**",
"<node_modules>/**"
]
}
]
}
通过 VS 代码,我可以挂钩到应用程序,并且应用程序可以在异常时中断 但是,没有源映射导致我的源代码中的所有断点都是“未绑定断点”
VS代码中加载的脚本列表显示
VS 代码调试器能够在 dist 中看到我的源代码的 node_modules 和 built 版本。另一个值得注意的一点是,用于构建 /dist 的源代码也可以直接在生产服务器的上层文件夹中获得。
在这种情况下,如何使用我未构建的源代码调试构建的生产过程?
我将 Chrome 行为添加为单独的问题
NodeJs: Chrome inspector can map source but unable to debug on original source
【问题讨论】:
标签: node.js debugging visual-studio-code remote-debugging vscode-debugger