vscode-live-server icon indicating copy to clipboard operation
vscode-live-server copied to clipboard

live server is not opening browser

Open lolorenzo777 opened this issue 2 years ago • 5 comments

I'm submitting a...

[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  <!-- Please search GitHub for a similar issue or PR before submitting -->
[ ] Feature request
[ ] Documentation issue or request
[ ] Other: <!-- Please describe: -->

Current behavior

When I set the configuration file to open chrome rather than the default browser (which is edge in my case), the browser do not open when we start liveserver.

{
    "liveServer.settings.CustomBrowser": "chrome",
}   

image

So the server start but the chrome do not open. 👎

If I leave the settings empty, edge opens when I start liveserver 👍

Expected behavior

setting "liveServer.settings.CustomBrowser": "chrome" should open the chrome when we start liveserver.

Environment

Browser:

- [x] Chrome (desktop) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] IE version XX
- [ ] Edge version XX

For Tooling issues:

- Live Server: v5.7.5
- Platform:  
  - W10
  - WSL2 
  - Ubuntu 20.04.4 LTS 
- Visual Studio Code:
  - VSCODE 1.67.2

Others

I've tested multiple solutions:

  • I've created an alias on wsl for chrome : alias chrome="/mnt/c/Program\ Files/Google/Chrome/Application/chrome.exe" but nothing change
  • I've used the setting liveServer.settings.AdvanceCutomBrowserCmdLine": "chrome --remote-debugging-port=5500 but nothing change

When I try "liveServer.settings.AdvanceCustomBrowserCmdLine": "blabla" nothing change and the server still starts at port 5500 (and not opening the browser) !

lolorenzo777 avatar Jun 07 '22 08:06 lolorenzo777

It seems that liveserver try to run the chrome but it can not find it.

A working workaround is to call chrome.exe installed under Windows directly in liverserver settings. With my configuration, the settings.json look like this:

{
    "liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe --remote-debugging-port=9222",
}

Then when now when I run liverserver the chrome browser opens

Hope this can help

lolorenzo777 avatar Jun 07 '22 09:06 lolorenzo777

hi @lolorenzo777 where should i paste this json in the vscode ? { "liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe --remote-debugging-port=9222", }

Nikhilkumarravula avatar Jun 28 '22 05:06 Nikhilkumarravula

hi @Nikhilkumarravula this is the settings.json vscode setting file. It's either in your local repo or in the global config https://code.visualstudio.com/docs/getstarted/settings

lolorenzo777 avatar Jul 11 '22 07:07 lolorenzo777

I also face like this error and i paste "liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe --remote-debugging-port=9222", in settings.json and still not working.The vs code said live server is working but chome does not open. I think, I face this problem after I had install mongodb to my laptop.Anyway if you have any solution for this can you tell me how can i fix this problem

PyaeSone99 avatar Jul 25 '22 13:07 PyaeSone99

"/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"

Have you checked where chrome is installed on your machine ? On a WSL terminal screen you can try find /mnt/c -type f -name "chrome.exe" 2>/dev/null to look where it is. Adjust "liveServer.settings.AdvanceCustomBrowserCmdLine" with your entry.

Hope this help

lolorenzo777 avatar Jul 25 '22 14:07 lolorenzo777