gpt4 book ai didi

node.js - 在 VS Code 中调试 Typescript Apollo Server (graphQL) 时未绑定(bind)断点

转载 作者:行者123 更新时间:2023-12-05 06:09:22 24 4
gpt4 key购买 nike

我是一名 Java 专家,刚开始接触 nodejs。我正在处理一个现有的 typescript 项目。我无法调试我的应用程序。断点变灰显示“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 文件夹中的 config.ts 文件中设置的断点处停止,继续运行时,应用程序会正常启动。发送 graphql 请求时,我得到了响应。但它不会在 src 目录中我的 .ts 文件(解析器)或 dist 目录中的 .js 文件中设置的断点处停止。我也尝试过使用 VS 代码 1.51.1,但没有成功。请帮忙。

提前致谢

最佳答案

让我们与我的工作配置进行比较,也许它可以帮助您了解出了什么问题(我看到我启动 TS 文件与您启动 JS 文件的第一个区别):

    {
"type": "node",
"request": "launch",
"name": "Launch TS Program",
"program": "${workspaceFolder}/app.ts",
"env": {
"NODE_ENV": "standalone"
},
"preLaunchTask": "tsc: build - tsconfig.json",
"cwd": "${workspaceFolder}",
"outFiles": [
"${workspaceFolder}/build/**/*.js"
],
"sourceMaps": true,
"outputCapture": "std"
},

和 tsconfig.json

{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"noImplicitAny": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"sourceMap": true,
"outDir": "build",
"typeRoots": [
"@types",
"node_modules/@types"
]
},
"include": [
"application/**/*",
"@types/**/*",
"app.ts"
]
}

关于node.js - 在 VS Code 中调试 Typescript Apollo Server (graphQL) 时未绑定(bind)断点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64810893/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com