简体   繁体   English

无法调试我的ts-node express项目(断点被忽略,因为未找到生成的代码)

[英]Can't debug my ts-node express project (Breakpoint ignored because generated code not found)

I'll use this project express-typescript-starter , but when I put the breakpoint and started debug on VS Code he said "Breakpoint ignored because generated code not found (source map problem?)." 我将使用这个项目express-typescript-starter ,但是当我将断点放在VS Code上并开始调试时,他说“断点被忽略了,因为未找到生成的代码(源映射问题?)。”

launch.json launch.json

"version": "0.2.0",
"configurations": [
    {
        "type": "node",
        "request": "launch",
        "name": "Launch Program",
        "program": "${workspaceRoot}\\index.js",
        "cwd": "${workspaceRoot}"
    },
    {
        "type": "node",
        "request": "attach",
        "name": "Attach to Process",
        "port": 5858
    }
]

tsconfig.json tsconfig.json

"compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "declaration": false,
    "noImplicitAny": false,
    "removeComments": true,
    "noLib": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true,
    "listFiles": false
},
"exclude": [
    "node_modules"
]

Should be necessary tasks.json using the tsc to generate the files JS and JS.MAP. 应该是必要的task.json使用tsc生成文件JS和JS.MAP。 But I don't know why because I put the break point on TS files and works to me... 但是我不知道为什么,因为我把断点放在了TS文件上并为我工作...

"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"args": ["-p", "."],
"showOutput": "silent",
"problemMatcher": "$tsc"

Repository with the solution: 解决方案的存储库:

https://github.com/bsalesc/express-typescript-starter/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM