我曾经能够让 Visual Studio Code 中断捕获和未捕获的异常。断点仍然被标记,但它不会中断。切换正常的断点可以很好地中断进程,只是每当我在任何地方抛出错误时它都不会中断。
这是我的launch.json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name" : "Attach",
"request" : "attach",
"type" : "node",
"restart" : true,
"port" : 9229,
"sourceMaps" : true,
"internalConsoleOptions": "neverOpen",
"remoteRoot" : "/home/node/dist",
"localRoot" : "${workspaceFolder}/dist",
"skipFiles" : ["${workspaceFolder}/node_modules/**/*.js", "<node_internals>/**/*.js"],
"outFiles" : ["${workspaceFolder}/dist/**/**.js"],
}
]
}
我正在使用 Docker 和 Node 镜像“fermium-alpine”, OS X 大苏尔 11.4。 VSCode 1.58.0。