-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WSL 2: ReactJS not reloading after saved. [Solved] #10253
Comments
Did you try it out with the |
@bennettdams I tried all other troubleshooting methods, none of them worked. I'm not running my project inside VM so why & how do I use |
@PrajjwalDatir "VM" is just the example the CRA team used for their documentation there. Really, Chokidar is a file watcher for Node, so it handles the "proxy" part of your development setup (remote container, WSL, VM, etc.). To quickly test it out, just change your start script in the |
Thanks! It works now 🕺 For future readers, find
and replace it with
|
I'm developing on the Windows subsystem for Linux, and the dev server wasn't auto-reloading when I made changes to the site. Followed the advice here to get a fix: facebook/create-react-app#10253
I moved my code from the mounted file system to ubuntu file system in |
I believe this issue happens for stuff that use the Chokidar package... React, Vue, Nodemon....all don't reload on save |
This didn't solve the issue for me. My situation remains same as described in the original issue description. I have also tried the |
I am facing the Same Issue. |
Same Issue here as well. Are you on Windows 11? |
Yes I am. My projects folder was placed on Desktop means in C: drive after some research I found out I need to place the project in linux folder itself. So I moved the project to linux folder i.e., "wsl\Ubuntu\home{$username}" and it worked even without |
Thanks! But I think it should have worked just using |
I am using Windows 10 with WSL2/Ubuntu 20.04 and experiencing the same issue. So it might not be specific to W11. As we see from others' comments, using |
Does not work :( |
+1 none of the proposed solutions are working for me on Win 11 WSL, node v17.4.0, npm v8.3.2, create-react-app v5.0.0, react v17.0.2 |
This is what I had to do to get it working again for me. Nothing else was working. Thanks for the advice. |
I had the same problem with hot reload on WSL even after changing package.json ("start": "CHOKIDAR_USEPOLLING=true react-scripts start"). After changing react-scripts version (and then npm install) hot reload works again. "dependencies": { |
I have been debugging for 4 hours, downgrading rom 5.0 5o 4.0.3 solved the problem. I cant thank you enough. I am 4 whiskeys in pulling my hair. |
This is what ultimately solved it for me, after trying trying both CHOKIDAR_USEPOLLING=true and FAST_REFRESH=false. |
I am now personally extremely skeptical of this appproach. Would-be adherents beware. Twice now upon resetting my computer, it's completely blown away the directory I put in -- edit -- -- edit 2 --
|
Version Inside your "scripts": {
"start": "react-scripts start", and replace it with "scripts": {
"start": "WATCHPACK_POLLING=true react-scripts start", See #12397 for more info |
This worked for me, thank you very much :) |
Agree -- I don't think is the best approach. According to this post, |
Also, see #10253 (comment) for a solution that worked for me. |
WATCHPACK_POLLING=true works thanks |
Fiz isso e deu certo no meu tbm |
Although WATCHPACK_POLLING=true works, i still have to refresh the page to see the results. Any ideas? |
this worked for me, last time hot reload stopped working, the fix for me was reinstalling WSL ubuntu. |
@nathanpovo thanks!! you are a life saver, I was finding solution for weeks. |
What I am experiencing is that refreshing on changes takes a little longer (about 3-5 sec). |
Dude man was searching for a solution, since 4 hrs, finally this worked. Thanks man. |
I had the same problem with hot reaload on WSL, after using the "CHOKIDAR_USEPOLLING=true" on package-json:
It Works, althought it's taking a lot of time to show the changes on screen. P.S. I'm using vue but thanks anyway! |
how do I do this? |
@danielcaze |
After a couple of hours of headscratching this solved the issue for me in my Homestead VM. Thank you! |
Thank you so much, it's finally working again ^^ |
What worked the best for me was to reinstall react-scripts, I first tried to replace the latest version with the 4.0.3, it worked, then I tried the latest (5.0.1) again and it also worked. However, make sure to MANUALLY trigger the first refresh of your app after reinstalling react-scripts, otherwise the auto refresh will not work. |
due to some answer in stackoverflow, that I'm so sorry for forgetting who answered that, I could fix this bug because I set up my wsl from version 2 to version 1.
|
Thank you! Working now. Edit: Docker Toolbox also supported! |
If anyone is using WSL 2 and react-scripts, then THIS IS THE WAY! |
WATCHPACK_POLLING=true in .env files |
Thx so much! This worked using colima on Mac |
Is your proposal related to a problem?
WSL2 : ReactJS not reloading after saved.
I recently installed WSL 2 but when I create an app using create-react-app and use npm start the app was’t reloaded when I edited and saved some file
Describe the solution you'd like
I want to use Hot Reloading on my Projects located in Windows file system.
WSL2 changed the file sharing protocol, from using their own custom developed protocol using the 9P protocol, which does not support file changes event for Create React App.
Describe alternatives you've considered
To FIX this issue : You can put your code on the Linux file system (example : in your user’s home directory ), and access these files through the WSL share, \wsl$\DISTRO_NAME from Windows.
Additional context
I wrote everything properly again here
https://prajjwaldatir.medium.com/create-react-app-not-working-62fc9fc4368b
The text was updated successfully, but these errors were encountered: