我突然无法调试我的 Angular 应用程序。不太确定我做了什么。我更新node.js后可能会发生这种情况
启动.json
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:4200",
"webRoot": "${workspaceFolder}/src",
"sourceMaps": true,
},
]
Run Code Online (Sandbox Code Playgroud)
错误:
Could not read source map for http://localhost:4200/runtime.js: Unexpected 503 response from http://127.0.0.1:4200/runtime.js.map: connect ECONNREFUSED 127.0.0.1:4200
Could not read source map for http://localhost:4200/vendor.js: Unexpected 503 response from http://127.0.0.1:4200/vendor.js.map: connect ECONNREFUSED 127.0.0.1:4200
Could not read source map for http://localhost:4200/main.js: Unexpected 503 response from http://127.0.0.1:4200/main.js.map: connect ECONNREFUSED 127.0.0.1:4200
Could not read source map for http://localhost:4200/styles.js: …Run Code Online (Sandbox Code Playgroud) 我希望能够使用Visual Studio Code调试Angular2应用程序.
这是我的环境:
使用angular-cli创建一个新项目:
ng new test-VSC-debug
cd test-VSC-debug
Run Code Online (Sandbox Code Playgroud)
然后我打开VSC并加载项目: File/open folder
我点击debug的标志,我configure launch.json的选择chrome.它生成以下文件:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Chrome against localhost, with sourcemaps",
"type": "chrome",
"request": "launch",
"url": "http://localhost:8080",
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
},
{
"name": "Attach to Chrome, with sourcemaps",
"type": "chrome",
"request": "attach",
"port": 9222,
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
}
]
}
Run Code Online (Sandbox Code Playgroud)
然后我通过运行启动angular2项目:
ng serve …Run Code Online (Sandbox Code Playgroud) google-chrome-devtools visual-studio-code angular-cli angular
我正在开发一个nodejs项目,其中所有代码都是用typescript编写的.它遵循微服务模式(并且每个微服务都是一个独立的项目),因此需要同时打开和调试许多项目.
我尝试过webstorm和visual studio(使用NTVS),但对两者都不满意.Webstorm忽略了许多构建错误(非常重要,因为这些错误会在CI期间失败),并且在智能感知和易用性方面不如视觉工作室好.另一方面,Visualstudio没有我想要的那么快.此外,我绑定到窗口和node_modules中的文件名长度问题是非常频繁和烦人的.
其他(atom,VSCode)没有打字稿调试支持(或者我错过了什么?).
你能分享一下你的经历吗?此外,我想知道哪些编辑谷歌开发人员可能会用来开发角度2 :)
我正在使用Visual Studio Code中的Chrome Debugger插件来调试Angular应用程序.在升级到使用angular/cli@1.7.0之后,我们在调试时不再能够在VS Code中的typescript代码中找到断点.如果我们回滚到angular/cli@1.6.7,断点会再次开始工作.
这是我的ng -v输出:
Angular CLI: 1.7.0
Node: 9.2.0
OS: win32 x64
Angular: 5.2.5
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cli: 1.7.0
@angular-devkit/build-optimizer: 0.3.1
@angular-devkit/core: 0.3.1
@angular-devkit/schematics: 0.3.1
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.0
@schematics/angular: 0.3.1
@schematics/package-update: 0.3.1
typescript: 2.5.3
webpack: 3.11.0
Run Code Online (Sandbox Code Playgroud)
还有其他人遇到过这种情况吗?
angular ×2
angular-cli ×2
breakpoints ×1
debugging ×1
ide ×1
node.js ×1
source-maps ×1
typescript ×1