21

Hi I've got a problem to run Chrome Debugger directly in VS Code. I'm working on Linux Mint.

Now i try to run debugger and error message says: Unable to launch browser: "Unable to find Chrome version stable. Available auto-discovered versions are: ["dev"]. You can set the "runtimeExecutable" in your launch.json to one of these, or provide an absolute path to the browser executable."

Following the sugesstion I've added runtimeExecutable to chromeExecutable and now the error is:

Unable to Attach to the browser.

Google Chrome is installed on my machine version: 83.0.4103.116-1.

Thanks for help in advance

Error: Error

Current config: Current Config

Lumito
  • 490
  • 6
  • 20
  • Close the chrome before starting to debug – isAif Jun 28 '20 at 09:54
  • Chrome is closed and the same error. – AdrianeZ - programuj Jun 28 '20 at 09:55
  • 1
    Are you using VS Code June 2020 version with [the new JS debugger](https://code.visualstudio.com/updates/v1_47#_new-javascript-debugger)? You could temporarily [use the old debugger](https://github.com/microsoft/vscode-js-debug/issues/582#issuecomment-657082466) by setting `debug.javascript.usePreview: false` in VS settings and using `type: chrome` in the launch config. – Jan M. Jul 12 '20 at 14:59
  • @JanM. `debug.javascript.usePreview` is no longer available starting from VSCode 1.60.0. Check out options on how to use the legacy debugger in [This answer](https://stackoverflow.com/a/69122112/1044637) – sorjef Sep 09 '21 at 17:03
  • Does this answer your question? [Cannot debug in VS Code by attaching to Chrome](https://stackoverflow.com/questions/45592581/cannot-debug-in-vs-code-by-attaching-to-chrome) – Vega Jul 11 '23 at 15:43

3 Answers3

27
1. Type chrome://version/ in Chrome browser.
2. Notice you will get some thing like this ::: 

Google Chrome :: 86.0.4240.80 (Official Build) (x86_64)

Revision :: 7ed88b53bda45a2d19efb4f8706dd6b6cad0d3af-refs/branch-heads/4240@{#1183}

OS :: macOS Version 10.15.7 (Build 19H2)

JavaScript :: V8 8.6.395.10

Flash :: 32.0.0.445 /Users/shivamgupta/Library/Application Support/Google/Chrome/PepperFlash/32.0.0.445/PepperFlashPlayer.plugin

User Agent :: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.80 Safari/537.36

Command Line :: /Applications/Chrome.app/Contents/MacOS/Google Chrome -psn_0_57358 --flag-switches-begin --flag-switches-end --restore-last-session

Executable Path :: /Applications/Chrome.app/Contents/MacOS/Google Chrome

Profile Path :: /Users/shivamgupta/Library/Application Support/Google/Chrome/Default

Variations :: 84085631-ab02a1cf dff70c3e-377be55a .......,.

Copy the Executable Path to runTimeExecutable

Now Copy this snippet in launch.json::
"configurations": [
    {
      "name": "Launch Chrome",
      "request": "launch",
      "type": "pwa-chrome",
      "url": "http://localhost:3000",
      "webRoot": "${workspaceFolder}/public",
      "runtimeExecutable": "/Applications/Chrome.app/Contents/MacOS/Google Chrome"
    }
]
Shivam Gupta
  • 271
  • 3
  • 4
  • Remember if you are on Linux there could be multiple instances there, please review your snap folder or use "current" folder link to always get the most updated version of chrome or chromium. – Aosi Sep 06 '21 at 22:30
15

I have the same problem. And found how to set

debug.javascript.usePreview: false in VS settings

enter image description here

Ben
  • 411
  • 3
  • 17
  • 1
    Finally, bravo! – Čikić Nenad Jul 27 '20 at 05:48
  • 2
    Can you explain what this setting is doing and why disabling it is supposed to solve the problem? I tried your solution and it did not work. I tried the solution proposed by Shivam Gupta and it did not work also until I re-enabled `debug.javascript.usePreview`. – Jean Paul Nov 17 '20 at 10:33
  • it did work, thanks, but i wonder what is wrong with the new debugger... – Andrei Aleksandrov Jan 25 '21 at 23:13
  • 1
    `debug.javascript.usePreview` is no longer available starting from VSCode 1.60.0. Check out options on how to use the legacy debugger in [This answer](https://stackoverflow.com/a/69122112/1044637) – sorjef Sep 09 '21 at 17:03
0

I had the same problem today, It works for me to use runtimeExecutable as @Shivam Gupta said,But I still want to know what is causing the problem. And finally found the reason.For some reason I have two chrome,One of the two is damaged,In chromeluncher in debuger, chromefinder is used to locate the location of chrome in your system.Without specifying a path, it will search for chrome. So another solution is to just delete the chrome you don't use. This way chromefinder can correctly find the chrome you are using.It works for me.

Kent.G
  • 1