html - 使用 VSCode 上的 Chrome 调试器的 WSL 2 出现 ECONNREFUSED 错误
问题描述
我在 Windows 10 机器上,VS Code with WSL 2 (Ubuntu 18.04) 试图使用Chrome 调试器扩展,但无济于事。以下是我的launch.json
:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch index.html",
"type": "chrome",
"request": "launch",
"file": "${workspaceFolder}/index.html",
"runtimeExecutable": "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
"runtimeArgs": [" --remote-debugging-port=9222"],
"userDataDir": "${workspaceFolder}/chrome",
"port": 9222
},
]
}
每当我按 F5 时,我都希望看到我的index.html
页面加载到新的 Chrome 选项卡中,但它所做的只是启动一个新的空白 Chrome 窗口,然后每隔大约 15 秒就会弹出两个错误。
我不太关心第一个错误,它说Google Chrome cannot read and write to its data directory: <VALID-DIRECTORY-ON-MY-MACHINE>
. 过去一天半以来我一直试图解决的是第二个错误,它说
Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:9222)
我在 Stack、GitHub、VS Code 开发网站等上尝试了很多解决方案,但没有任何帮助。在我的 Chrome 浏览器上,http://localhost:9222/json
抛出一些我理解为意味着浏览器应该可以连接的内容:
[ {
"description": "",
"devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9222/devtools/page/E7E1DFE661F744BE79A572564251BC39",
"id": "E7E1DFE661F744BE79A572564251BC39",
"title": "New Tab",
"type": "page",
"url": "http://localhost:9222/json",
"webSocketDebuggerUrl": "ws://localhost:9222/devtools/page/E7E1DFE661F744BE79A572564251BC39"
}, {
"description": "",
"devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9222/devtools/page/C089932CAB5A26F4409B78F887C84A50",
"id": "C089932CAB5A26F4409B78F887C84A50",
"title": "about:blank",
"type": "page",
"url": "about:blank",
"webSocketDebuggerUrl": "ws://localhost:9222/devtools/page/C089932CAB5A26F4409B78F887C84A50"
} ]
此外,我还在我的settings.json
:"remote.extensionKind": {"msjsdiag.debugger-for-chrome": "workspace"}
基于此推荐。我还重新启动了我的机器,启动 VS Code,然后启动(不打开任何其他 Chrome 窗口)。
似乎所有应该工作的东西都没有,这意味着我可能在这里误解了一些东西。我的问题是,我在这里做错了什么吗?
解决方案
这是vscode的一个错误。可以通过将扩展 'JavaScript Debugger' 替换为 'JavaScript Debugger (Nightly) '来解决此问题。见:https ://github.com/microsoft/vscode/issues/120227
推荐阅读
- python - 没有名为“darkflow.cython_utils.cy_yolo_findboxes”的模块
- android - 从 Android 共享意图下载文件
- fonts - 用于嵌入式系统的 CJK 字体
- java - 使用 JsonObjectRequest 和 GET 请求发送 JSON 正文
- android - 使用 executor 在 android 中运行下载管理器任务
- python - 如何修改视图以仅向一个分配的用户显示数据?
- java - java.sql.SQLException:字段 'useremail' 没有默认值
- python - 当使用 tkinter 中的复选框使用 for 循环放置在他的窗口中时,有没有办法让它们引用不同的变量?
- javascript - 将图标放在带有文本溢出省略号的两行行之后,而不会中断第 3 行
- django - VSCode Django 虚拟环境包装器