VSC 断点保持未绑定
VSC breakpoints remain unbound
我正在尝试使用 Visual Studio 代码调试器来调试 Node.js 应用程序。但是,所有断点都保持“未绑定”状态。为什么断点不绑定?
我使用 VSC v1.55.2 和 Node v9.8.0。
我的配置 launch.json
:
{
"configurations": [
{
"name": "Debug Server Side",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"program": "${workspaceFolder}/server.js",
"request": "launch",
"restart": true,
"runtimeExecutable": "nodemon",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node",
// I added:
"localRoot": "${workspaceFolder}",
"remoteRoot": "/",
"trace": true,
}
]
}
我试过什么但没有效果:
- 我按照 https://github.com/microsoft/vscode/issues/102166#issuecomment-657138385
的推荐使用 Use debug.javascript.usePreview: false
- 我按照某些帖子中的建议添加了
localRoot
和 remoteRoot
。
启动调试器时的输出:
cd "C:\Users\Xxx\Documents\vsc portal" ; /usr/bin/env '
NODE_OPTIONS=--require C:\Users\Xxx\AppData\Local\Temp\vscode-js-debug-bootlo
ader.js' 'VSCODE_INSPECTOR_OPTIONS={"inspectorIpc":"\\.\pipe\node-cdp.7888-
2.sock","deferredMode":false,"waitForDebugger":"","execPath":"C:\Program Files
\nodejs\node.exe","onlyEntrypoint":false,"autoAttachMode":"always","fileCallb
ack":"C:\Users\Xxx\AppData\Local\Temp\node-debug-callback-4cee0248d1dfa
f08"}' "C:\Program Files\nodejs\nodemon.cmd" .\server.js
Debugger listening on ws://127.0.0.1:55555/88f9181c-b2e1-4fe9-9df1-a20ba0485382
For help see https://nodejs.org/en/docs/inspector
[nodemon] 2.0.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node .\server.js`
Debugger listening on ws://127.0.0.1:55556/d9fd2280-08b7-4f4a-892d-f6562ec9441f
For help see https://nodejs.org/en/docs/inspector
Debugger listening on ws://127.0.0.1:55561/e504b1f9-67cf-41fc-89f7-cf3127f6850d
For help see https://nodejs.org/en/docs/inspector
详细日志:https://www.dropbox.com/s/x8x6nv9jvevcs74/vscode-debugadapter-b56a956a.json?dl=0
例如,我在 server.js
的第 3 行和第 5 行添加了一个断点,它们都是未绑定的:
const app = require("./app");
const { SERVER_PORT } = process.env;
app.set("port", SERVER_PORT);
const server = app.listen(app.get("port"), () => {
console.log(`Server running → PORT ${server.address().port}`);
});
我使用的是 Node 版本 9.8.0,更新到 Node 版本 14.15.1 解决了这个问题。
我正在尝试使用 Visual Studio 代码调试器来调试 Node.js 应用程序。但是,所有断点都保持“未绑定”状态。为什么断点不绑定?
我使用 VSC v1.55.2 和 Node v9.8.0。
我的配置 launch.json
:
{
"configurations": [
{
"name": "Debug Server Side",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"program": "${workspaceFolder}/server.js",
"request": "launch",
"restart": true,
"runtimeExecutable": "nodemon",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node",
// I added:
"localRoot": "${workspaceFolder}",
"remoteRoot": "/",
"trace": true,
}
]
}
我试过什么但没有效果:
- 我按照 https://github.com/microsoft/vscode/issues/102166#issuecomment-657138385 的推荐使用
- 我按照某些帖子中的建议添加了
localRoot
和remoteRoot
。
Use debug.javascript.usePreview: false
启动调试器时的输出:
cd "C:\Users\Xxx\Documents\vsc portal" ; /usr/bin/env '
NODE_OPTIONS=--require C:\Users\Xxx\AppData\Local\Temp\vscode-js-debug-bootlo
ader.js' 'VSCODE_INSPECTOR_OPTIONS={"inspectorIpc":"\\.\pipe\node-cdp.7888-
2.sock","deferredMode":false,"waitForDebugger":"","execPath":"C:\Program Files
\nodejs\node.exe","onlyEntrypoint":false,"autoAttachMode":"always","fileCallb
ack":"C:\Users\Xxx\AppData\Local\Temp\node-debug-callback-4cee0248d1dfa
f08"}' "C:\Program Files\nodejs\nodemon.cmd" .\server.js
Debugger listening on ws://127.0.0.1:55555/88f9181c-b2e1-4fe9-9df1-a20ba0485382
For help see https://nodejs.org/en/docs/inspector
[nodemon] 2.0.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node .\server.js`
Debugger listening on ws://127.0.0.1:55556/d9fd2280-08b7-4f4a-892d-f6562ec9441f
For help see https://nodejs.org/en/docs/inspector
Debugger listening on ws://127.0.0.1:55561/e504b1f9-67cf-41fc-89f7-cf3127f6850d
For help see https://nodejs.org/en/docs/inspector
详细日志:https://www.dropbox.com/s/x8x6nv9jvevcs74/vscode-debugadapter-b56a956a.json?dl=0
例如,我在 server.js
的第 3 行和第 5 行添加了一个断点,它们都是未绑定的:
const app = require("./app");
const { SERVER_PORT } = process.env;
app.set("port", SERVER_PORT);
const server = app.listen(app.get("port"), () => {
console.log(`Server running → PORT ${server.address().port}`);
});
我使用的是 Node 版本 9.8.0,更新到 Node 版本 14.15.1 解决了这个问题。