4

I am working in WSL2 on Windows 11 trying to run an index.js file with Live Server. Whenever I open Live Server it seems that I can only do so when I use Microsoft Edge. This seems to add another layer of problems because the JavaScript does not seem to be working as I would expect. For example, if I click a button element I don't see any animations to signify a "click".

I have checked that "liveServer.settings.CustomBrowser": "chrome" is indeed reflectin Chrome in the VS Code settings, but when this is the case there are no windows that pop up at all. The only thing that I see trigger is a notification that tells me that the server is active on Port 5000, just no window popping up to demonstrate that. Ideally I would like to try and open Live Server with Chrome, but if this isn't possible in Windows 11 then is there a way to make JavaScript behave in Microsoft Edge?

GrayLiterature
  • 381
  • 2
  • 13

1 Answers1

2

I've the same configuration and the same issue. I've raised the issue #2445 in Github.

A workaround solution is to call directly your chrome program installed under windows to your liveserver setting.

  1. check that chrome is well installed on W10 or W11. You can test it by opening a command line and running "start chrome", then chrome browser must open.
  2. look for chrome' installed directory. You can use this command to find it: sudo find /mnt/c/ -type f -iname chrome.exe 2>&1 | grep -v "Permission denied". For me this it's here:mnt/c/Program Files/Google/Chrome/Application.chrome.exe.
  3. Now change liveserver setting on your settings.json file:
{
    "liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe --remote-debugging-port=9222",
}

Now chrome should start when you run liverserver.

Hope this help

miky
  • 97
  • 7