目前,我正试图在visual studio中打开一个html文件,并在visual studio中运行google Chromes调试扩展。
下面是.json文件,我正在使用第一个配置
{
"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}"
}
]但是当它在google中打开时,我会收到错误。
到不了这个网站 本地主机拒绝连接。
发布于 2017-09-06 19:25:21
我也有过同样的问题。
有一个临时解决方案,即将"file": "${workspaceRoot}/index.html"添加到launch.json配置中。
此更改将允许您在Chrome浏览器中打开您的webapp,并且您将能够进行调试、中断points...however,,同时考虑到浏览器将呈现您的项目,就像它在运行本地文件一样,而则不使用webserver环境。
下面是launch.json配置文件:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceRoot}",
"file": "${workspaceRoot}/index.html"
}
]
}发布于 2017-09-22 08:55:00
在花了一些时间进行VScode调试之后,我意识到以下事实:
如何用“Chrome调试器”和“活动服务器”扩展进行调试:
发布于 2019-06-17 14:09:44
找到了另一种选择:
ng serveF5启动铬调试器https://stackoverflow.com/questions/38738905
复制相似问题