I'm on a Windows 10 machine, VS Code with WSL 2 (Ubuntu 18.04) trying to use the Chrome debugger extension, but to no avail. The following is my 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
},
]
}
I was expecting to see my index.html
page loaded in a new Chrome tab whenever I press F5, but all it does is start a new, blank Chrome window and then two errors pop up about 15 seconds apart.
I'm less concerned about the first error, which says Google Chrome cannot read and write to its data directory: <VALID-DIRECTORY-ON-MY-MACHINE>
. What I have been trying to address for the past day and a half is the second error, which says
Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:9222)
I tried a lot of the solutions on Stack, GitHub, VS Code dev site etc. but nothing helps. On my Chrome browser, http://localhost:9222/json
throws out some content which I understood to mean that the browser should be available for connection:
[ {
"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"
} ]
In addition, I've also set in my settings.json
: "remote.extensionKind": {"msjsdiag.debugger-for-chrome": "workspace"}
based on this recommendation. I've also restarted my machine, start VS Code and then launch (without opening any other Chrome windows).
It seems that all the things that were supposed to work doesn't, which meant that I could be misunderstanding something here. My question is, is there something that I'm doing incorrectly here?