[英]Why does debugger break on /***/ }),
I am trying to run the Angular "get started" app.我正在尝试运行 Angular“开始”应用程序。 I am running it in VS Code.
我在 VS Code 中运行它。 When I run the app the debugger stops on the line of code shown below and I am wondering why.
当我运行应用程序时,调试器在下面显示的代码行上停止,我想知道为什么。
Steps to reproduce:重现步骤:
Download the demo app from this link .从此链接下载演示应用程序。 (I couldn't find the download button either.)
(我也找不到下载按钮。)
Unzip the file解压文件
run npm install运行 npm 安装
run ng serve运行服务
fix angular.json - add src/ to typescript file ref修复 angular.json - 将 src/ 添加到 typescript 文件参考
run ng update -all see package.json below运行 ng update -all 请参阅下面的 package.json
run ng serve运行服务
start debugging in visual studio code在 Visual Studio 代码中开始调试
debugger breaks on this line:调试器在这一行中断:
/***/ }),
I don't see an error message... what does this mean?我没有看到错误消息...这是什么意思? The tab in VS Code says the file is main.js and it is located at localhost:4200\main.js - where ever that may be.
VS Code 中的选项卡显示该文件是 main.js,它位于 localhost:4200\main.js - 可能在哪里。
{
"name": "odpeknvxnlq.angular",
"version": "0.0.0",
"private": true,
"dependencies": {
"rxjs": "6.5.5",
"tslib": "^1.10.0",
"zone.js": "~0.10.2",
"jasmine-core": "3.5.0",
"@angular/core": "9.1.1",
"@angular/forms": "9.1.1",
"@angular/common": "9.1.1",
"@angular/router": "9.1.1",
"jasmine-marbles": "0.6.0",
"@angular/compiler": "9.1.1",
"@angular/animations": "9.1.1",
"@angular/platform-browser": "9.1.1",
"angular-in-memory-web-api": "0.10.0",
"@angular/platform-browser-dynamic": "9.1.1"
},
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.901.1",
"@angular/cli": "~9.1.1",
"@angular/compiler-cli": "~9.1.1",
"@angular/language-service": "~9.1.1",
"@types/node": "^12.11.1",
"@types/jasmine": "~3.5.10",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^5.1.2",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~5.0.1",
"karma": "~5.0.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.1",
"karma-jasmine": "~3.1.1",
"karma-jasmine-html-reporter": "^1.5.3",
"protractor": "~5.4.0",
"ts-node": "~8.8.2",
"tslint": "~6.1.1",
"typescript": "~3.8.3"
}
}
I was experiencing the same issue as you with no apparent solution.我遇到了和你一样的问题,没有明显的解决办法。 Here's how I got Chrome to stop breaking on that line: I edited my
main.ts
file and added/removed some carriage returns just to force the next "ng serve" to rebuild this file.以下是我让 Chrome 停止在该行中断的方法:我编辑了我的
main.ts
文件并添加/删除了一些回车符,只是为了强制下一个“ng serve”重建这个文件。 I suspect it is related to some sort of caching that we cannot directly affect by adding/removing breakpoints.我怀疑它与某种我们无法通过添加/删除断点直接影响的缓存有关。
Note: The github.com/microsoft/vscode-chrome-debug/issues/690 link mentioned by @JensV in the comments is dead.注意: @JensV 在评论中提到的 github.com/microsoft/vscode-chrome-debug/issues/690 链接已失效。 Perhaps it explained or offered a better way to stop this problem from happening.
也许它解释或提供了一种更好的方法来阻止这个问题的发生。
Edit: Here's the solution.编辑:这是解决方案。 VSCode will apparently stop execution in debug mode if you have any unbound breakpoints .
如果您有任何未绑定的断点,VSCode 显然会在调试模式下停止执行。 It also does not log a trace event for this behavior (or, at least, anything obvious).
它也不会记录此行为的跟踪事件(或者,至少,任何明显的事件)。 I filed a bug report with GitHub which helped me get to the bottom of it: https://github.com/microsoft/vscode/issues/119909
我向 GitHub 提交了一份错误报告,帮助我深入了解: https://github.com/microsoft/vscode/issues/119909
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.