Adan Moses
Adan Moses

Reputation: 43

Issues with VSCode Debugger and Live Server (JS)

as stated in the title I'm having issues trying to use the VSCode debugger with Live Server to debug a JavaScript app, I keep getting:

Cannot connect to the target at localhost:9222: Could not connect to debug target at http://localhost:9222: Could not find any debuggable target.

When I open my launch.json this is what I have in it:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Attach to Chrome",
      "port": 9222,
      "request": "attach",
      "type": "pwa-chrome",
      "webRoot": "${workspaceFolder}"
    }
  ]
}

In VSCode's settings.json I have:

"liveServer.settings.AdvanceCustomBrowserCmdLine": "chrome  --remote-debugging-port=9222"

I've looked all over the internet and nothing seems to work, there's a few posts here and there but they are a bit old, they ask to download chrome debugger extension for VSCode but it's deprecated since VSCode now has it natively. I did try installing it anyway but didn't change anything. Live server is running on port 5500.

Hopefully someone out there is able to help me, I want to get away from using console.log() everywhere.

Upvotes: 0

Views: 1443

Answers (1)

Adan Moses
Adan Moses

Reputation: 43

** SOLVED ** My colleague helped me with this one, I had to right-click on chrome then right-click on the chrome profile and go to properties, this will open the properties window, finally add --remote-debugging-port=9222 at the end of the "Target" option in the Shortcut Tab.

Upvotes: 2

Related Questions