vscode-live-server
vscode-live-server copied to clipboard
Live Reload not working in Remote Window (WSL)
I'm submitting a...
[x ] 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 using VS Code as a remote window connected to WSL (Ubuntu 18.04) the live reload feature of Live Server does not work.
Expected behavior
Live reload to work as it does when not in a remote window connected to WSL.
Environment
Browser:
- [x] Chrome (desktop) version 80.0.3987.163
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Live Server: 5.6.1 <!-- Check which version is installed -->
- Platform: Windows | Ubuntu 18.04 WSL <!-- Mac, Linux, Windows -->
- Visual Studio Code: 1.45.0-insider <!-- `code --version` -->
Others
When not using a remote window, the live reload feature works.
I' m having the same issue too with Ubuntu 20.04 LTS WSL2 on windows 10 where auto refreshing doesn't work. Works fine fine when not connected to WSL. Whatever the bug is it is also affects Parcel.
Has anyone found a solution for this?
The problem seems still present. I have the same issue: Ubuntu 18.04 LTS (WSL2) Windows 10 Pro Chrome Version 87.0.4280.88 (I tried defining the chrome.exe path as the BROWSER environment variable in .brashrc but no success)
The same happens if I try this with the npm version of live server
Any work around?
it's working here. live server 5.6.1,wsl2, browser run in windows host.
Im having the same issue too in Arch linux (WSL2) using firefox developer edition.
I solved it by looking for the local ip of my machine using ifconfig in the terminal, copy the ip, paste it in my browser and then :5500 (live server)
To fix this issue go to Settings make sure you're under Remote[WSL:"your linux distro"] and modify the Live Server>Settings: Advance Custom Browser CMD Line click edit in settings.json it should look like this: "liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" change the path a needed for Firefox, Edge etc.
It seems the extension is looking within the OS for the browser as installing linux chrome also works, but under wsl its not too good so Id suggest th above fix or maybe adding chrome to the path for linux
To fix this issue go to Settings make sure you're under Remote[WSL:"your linux distro"] and modify the Live Server>Settings: Advance Custom Browser CMD Line click edit in settings.json it should look like this: "liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" change the path a needed for Firefox, Edge etc.
It seems the extension is looking within the OS for the browser as installing linux chrome also works, but under wsl its not too good so Id suggest th above fix or maybe adding chrome to the path for linux
Thanks from Brazil.
To fix this issue go to Settings make sure you're under Remote[WSL:"your linux distro"] and modify the Live Server>Settings: Advance Custom Browser CMD Line click edit in settings.json it should look like this: "liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" change the path a needed for Firefox, Edge etc.
It seems the extension is looking within the OS for the browser as installing linux chrome also works, but under wsl its not too good so Id suggest th above fix or maybe adding chrome to the path for linux
Thanks from México!
I've tried to implement what you said above similar time but it still doesn't fixes. The 2nd method which said about adding chrome to path for linux, how do i do that? any idea?
Después de unas horitas, encontré esta solución:
Vaya a Configuración, asegúrese de estar en Remoto [WSL: "su distribución de Linux"] y modifique Live Server> Configuración
Se modificara: "liveServer.settings.port": 5500
Por defecto esta en el port 5500. Puedes cambiarlo a otro en mi caso solo puse 5501
Asegúrate que en la parte inferior derecha te salga el nuevo valor del puerto cuando lo ejecutes:
To fix this issue go to Settings make sure you're under Remote[WSL:"your linux distro"] and modify the Live Server>Settings: Advance Custom Browser CMD Line click edit in settings.json it should look like this: "liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" change the path a needed for Firefox, Edge etc.
Based on this answer, i've prepared the config to support 1 browser, you just need to uncomment your preffered browser:
{
//"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"
//"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
//"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe"
//"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
//"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Users/<<USERNAME>>/AppData/Local/Programs/Opera/opera.exe"
//"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Users/<<USERNAME>>/AppData/Local/Programs/Opera GX/opera.exe"
}
Note - To reach the Opera browsers just rename <<USERNAME>>
with your current username.
Note² - The Firefox folder may vary depending on the source you've installed.
Hola muy buenas noches, cordial saludo a todos tengo una pregunta, VS CODE bien puedo visualizar los codigo que estoy creando para paginas de practica, pero me aparece un problema que cuando yo le doy en live server aparece port 500 y deberia aparecer la pagina de practica en una ventana de google chrome, pero no me aparece nada ni errores ni nada es algo extraño es la primera vez que me pasa eso como soluciono eso?
Hi, I've managed to finally get this to work:
-
Before that I had mistakenly linked the [liveServer.settings.AdvanceCustomBrowserCmdLine] to 'Program Files' when my browser was installed in 'Program Files (x86)', afterwards it managed to pop out and load the html, however it was not 'live'....meaning I still had to refresh to see any changes.
-
After shifting my working files (which were in D drive) to the same directory (C drive /desktop) that the browser was installed in, it seems to be running fine.
-However, if you were to run it on the local drive ( not in WSL ) do note that the [liveServer.settings.AdvanceCustomBrowserCmdLine] directory might have to be edited for it to work on the local drive again, since it's linked differently on WSL( /mnt/c/Program Files ) instead of local(C:\Program Files .....)
To fix this issue go to Settings make sure you're under Remote[WSL:"your linux distro"] and modify the Live Server>Settings: Advance Custom Browser CMD Line click edit in settings.json it should look like this: "liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" change the path a needed for Firefox, Edge etc.
Based on this answer, i've prepared the config to support 1 browser, you just need to uncomment your preffered browser:
{ //"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" //"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe" //"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe" //"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Mozilla Firefox/firefox.exe" //"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Users/<<USERNAME>>/AppData/Local/Programs/Opera/opera.exe" //"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Users/<<USERNAME>>/AppData/Local/Programs/Opera GX/opera.exe" }
Note - To reach the Opera browsers just rename
<<USERNAME>>
with your current username. Note² - The Firefox folder may vary depending on the source you've installed.
This worked for me, I was having a hell of a time trying to figure this out. Thank you
To fix this issue go to Settings make sure you're under Remote[WSL:"your linux distro"] and modify the Live Server>Settings: Advance Custom Browser CMD Line click edit in settings.json it should look like this: "liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" change the path a needed for Firefox, Edge etc.
Based on this answer, i've prepared the config to support 1 browser, you just need to uncomment your preffered browser:
{ //"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" //"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe" //"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe" //"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Mozilla Firefox/firefox.exe" //"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Users/<<USERNAME>>/AppData/Local/Programs/Opera/opera.exe" //"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Users/<<USERNAME>>/AppData/Local/Programs/Opera GX/opera.exe" }
Note - To reach the Opera browsers just rename
<<USERNAME>>
with your current username. Note² - The Firefox folder may vary depending on the source you've installed.
woked like charm
please add brave
"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe"
To fix this issue go to Settings make sure you're under Remote[WSL:"your linux distro"] and modify the Live Server>Settings: Advance Custom Browser CMD Line click edit in settings.json it should look like this: "liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" change the path a needed for Firefox, Edge etc.
It seems the extension is looking within the OS for the browser as installing linux chrome also works, but under wsl its not too good so Id suggest th above fix or maybe adding chrome to the path for linux
Worked liked a charm.
To fix this issue go to Settings make sure you're under Remote[WSL:"your linux distro"] and modify the Live Server>Settings: Advance Custom Browser CMD Line click edit in settings.json it should look like this: "liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" change the path a needed for Firefox, Edge etc.
It seems the extension is looking within the OS for the browser as installing linux chrome also works, but under wsl its not too good so Id suggest th above fix or maybe adding chrome to the path for linux
Thanks, It worked for me with Edge.
Hola, tengo windows 11, y trabajo en ubuntu 20.04, tengo este mismo problema, cuando hago correr el live server, se abre el navegador con el archivo, y a medida que hago cambios y guardo, los mismos se ven reflejados en el navegador. Lo que no puedo hacer es ejecutar con F5 o crtl F5, porque ahi solo abre el navegador y muetra la ubicacion del archivo y que no encuentra al mismo. Alguno me podra ayudar? estoy segurp que es algo en la configuracion. Gracias
To fix this issue go to Settings make sure you're under Remote[WSL:"your linux distro"] and modify the Live Server>Settings: Advance Custom Browser CMD Line click edit in settings.json it should look like this: "liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" change the path a needed for Firefox, Edge etc.
It seems the extension is looking within the OS for the browser as installing linux chrome also works, but under wsl its not too good so Id suggest th above fix or maybe adding chrome to the path for linux
Thanks from Uruguay!
To fix this issue go to Settings make sure you're under Remote[WSL:"your linux distro"] and modify the Live Server>Settings: Advance Custom Browser CMD Line click edit in settings.json it should look like this: "liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" change the path a needed for Firefox, Edge etc.
It seems the extension is looking within the OS for the browser as installing linux chrome also works, but under wsl its not too good so Id suggest th above fix or maybe adding chrome to the path for linux
Thanks from India!
For anyone wondering for firefox : "liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
To fix this issue go to Settings make sure you're under Remote[WSL:"your linux distro"] and modify the Live Server>Settings: Advance Custom Browser CMD Line click edit in settings.json it should look like this: "liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" change the path a needed for Firefox, Edge etc.
It seems the extension is looking within the OS for the browser as installing linux chrome also works, but under wsl its not too good so Id suggest th above fix or maybe adding chrome to the path for linux
Thanks alot!
Um dieses Problem zu beheben, gehen Sie zu „Einstellungen“, stellen Sie sicher, dass Sie sich unter „Remote“ [WSL: „Ihre Linux-Distribution“] befinden, und ändern Sie „Live Server“ > „Einstellungen: Erweiterte benutzerdefinierte Browser-CMD-Zeile“. Klicken Sie in „settings.json“ auf „Bearbeiten“. Es sollte so aussehen: „liveServer“ . .settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" den für Firefox, Edge usw. benötigten Pfad ändern.
Es scheint, dass die Erweiterung im Betriebssystem nach dem Browser sucht, da die Installation von Linux Chrome auch funktioniert, aber unter WSL ist es nicht so gut, also würde ich die obige Korrektur vorschlagen oder vielleicht Chrome zum Pfad für Linux hinzufügen
Thanks mate you are awesome 🙌
For anyone wondering for firefox :
"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
Amazing, thanks!
To fix the problem I simply installed the WSL extension in VSCODE. I opened the terminal normally and within the index.html
file I used the standard shortcut to open the Live Server
.
Hot reload worked normally. However, I haven't tested it for a long time in my applications, so I leave a warning sign for anyone who uses the method.
A big hug from Brazil!!
I solved it by looking for the local ip of my machine using ifconfig in the terminal, copy the ip, paste it in my browser and then :5500 (live server)
Thank you, this is what worked for me.