【发布时间】:2021-02-24 20:52:42
【问题描述】:
我是一个 java 人,并且是 nodejs 的新手。我正在处理现有的打字稿项目。我无法调试我的应用程序。断点变灰并显示“Breakpoint set but not yet bound”
VS CODE
-------
Version: 1.46.1 (user setup)
Commit: cd9ea6488829f560dc949a8b2fb789f3cdc05f5d
Date: 2020-06-17T21:13:20.174Z
Electron: 7.3.1
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18363
launch.json
----------
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Prospector",
"program": "${workspaceFolder}/dist/main.js",
"preLaunchTask": "npm: build",
"env": {"NODE_ENV":"loc"},
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"skipFiles": [
"${workspaceFolder}/node_modules//*.js",
"<node_internals>//*.js"
]
}
]
}
tsconfig.json
--------
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"lib": [
"es6",
"esnext"
],
"declaration": false,
"sourceMap": true,
"outDir": "dist",
"rootDir": "src",
"removeComments": true,
"strict": true,
"noImplicitAny": true,
"moduleResolution": "node",
"strictNullChecks": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"exclude": [
"tools"
]
}
Debug Console
------------
C:\Program Files\nodejs\node.exe --inspect-brk=20574 C:\Data\work\NodeProjects\reu-ext-gql-api\dist\main.js
Debugger listening on ws://127.0.0.1:20574/537adef1-2250-40b3-8980-b43c0f751836
For help, see: https://nodejs.org/en/docs/inspector
Fetching config from local config files
config.factory.ts:25
Apollo Server (graphQL) listens on http://localhost:8080/RegisteredEndUserExtended
当启动应用程序时,它会在 node_modules 文件夹中的配置 .ts 文件中设置的断点处停止,当继续时,应用程序会正常启动。发送 graphql 请求时,我得到了响应。但它不会停止在 src 目录中我的 .ts 文件(解析器)或 dist 目录中的 .js 文件中设置的断点处。我也尝试使用 VS code 1.51.1,但没有运气。请帮忙。
提前致谢
【问题讨论】:
-
你解决过这个问题吗?我有同样的问题,除了解析器之外,断点在代码的所有其他区域都可以正常工作
标签: node.js typescript vscode-debugger