question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not reloading browser (WSL)

See original GitHub issue

Issue details

Browsersync is failing to reload my browser. I’m attempting to use it for the first time on a new machine, running WSL. In the simplest case this manifests as the browser not reloading when files are changed. I have also tried running a couple of different static site generators (11ty and Jigsaw), in both cases the servers become unresponsive after a file is changed, hanging at [reloading browser]. (I have used both of these tools successfully on another machines running WSL).

Steps to reproduce/test case

  1. Create index.html
  2. Create css/styles.css
  3. Run browser-sync start --server --files "css/*.css"
  4. Edit css/styles.css

Please specify which version of Browsersync, node and npm you’re running

  • Browsersync [ 2.26.13 ]
  • Node [ 8.17.0 ]
  • Npm [ 6.13.4 ]

Affected platforms

  • linux
  • windows
  • OS X
  • freebsd
  • solaris
  • other (please specify which)

Browsersync use-case

  • API
  • Gulp
  • Grunt
  • CLI

If CLI, please paste the entire command below

browser-sync start --server --files "css/*.css"

for all other use-cases, (gulp, grunt etc), please show us exactly how you’re using Browsersync

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

3reactions
lszecommented, Nov 30, 2020

I was able to fix a ton of unexpected Browser-sync behavior and slowness in WSL2 by making sure all my projects are under my WSL home user path /home/user/ rather than under a Windows path /mnt/c/.

0reactions
yuripalladacommented, Nov 15, 2021

@smth Not sure which IDE you’re using, but if you’re using Visual Studio Code and want to have the files in WSL2, you can install the Remote - WSL extension in visual studio code.

  1. Open VScode on your windows machine
  2. Install the Remote - WSL extension
  3. Go to the WSL2 filesystem and the folder you want to open with code
  4. type code .
  5. WSL2 will install VS Code server, and open VS Code on your local machine. The directory that it opens is directly linked to the directory in WSL2, which means you can go ahead and do yarn start in your WSL2 terminal, open the browser with browsersync, and edit code in your VS Code window on the host machine, and it will perfectly reload the browser when you save code in VS Code now!

I hope this helps, it works for me!

Read more comments on GitHub >

github_iconTop Results From Across the Web

WSL 2 , React not reloading with file changes? - Stack Overflow
In my experience, this occurs when your source is on a Windows drive (e.g. /mnt/c ) since the driver that WSL uses for...
Read more >
WSL 2: React not reloading with file changes - Reddit
I recently installed WSL 2 but when I create an app using create-react-app and use npm start the app is not reloaded when...
Read more >
Fixing Hot Module Reload of Vite App in WSL - YouTube
Is hot reloading not working in your app created with Vite? For Windows and WSL users polling might the solution to your problems....
Read more >
Remote WSL connection doesn't update Vue.js app on code ...
Create a new Vue.js project (or anything that support live reloading); Use WSL node.js instead of bundled one; Start debugging; Edit some code....
Read more >
Troubleshooting Windows Subsystem for Linux | Microsoft Learn
This is likely because your machine has not yet taken the backport for WSL 2. The simplest way to resolve this is by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found