-
Notifications
You must be signed in to change notification settings - Fork 822
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
WSL2: nodemon file watcher no longer working #4169
Comments
Yep. The /Build 2019 presentation the devs mention that they (quoth) "still need to plumb" In the meantime, the WSL 2 launch blog post suggests:
Faster, yes. But for the purposes of your scenario (and a few other edge cases), also to have access to the complete set of ext4 filesystem features. |
That makes sense. Moving my project into the linux file system solves the issues with inotify. Thanks |
This is related to #4064 (comment) just like #4224. |
@therealkenc @adamlacombe Could you please elaborate on how to solve this by putting the project into the linux file system so that inotify works? Would like to be able to run docker containers from windows, map the files in as volumes and have changes auto-reload by using inotify/related tools e.g. nodemon/hotreload/Quasar is this possible? |
@LiamKarlMitchell the linux file system is the /home/* folder. It will work faster and better if you move/clone your code there. Also remember to install any tool you need in it's Linux version. The Docker for Windows Edge with WSL2 backend supports your scenario but you will also need to use VSCode Remote Extensions in order to edit files with inotify support inside the Linux distro. |
Just run Yeah, go back to WSL 1, it just works. |
but what if you are using WSL 2 for a reason |
You can migrate all your projects to the linux partition within WSL and then access the files via |
@adamlacombe do you mean you've managed to get nodemon working on WSL 2 by moving the project into the linux file system? Does this not give you issues when editing files from a windows code editor? I can't seem edit any linux file systems files from Visual Studio Code per example.. Thanks |
Yeah it works fine in the WSL 2 file system faster as well :) |
Thanks @LiamKarlMitchell! |
@fonziemedia how did you give the permission? Do you still have your files on windows file system or you also moved it to linux file system? |
Hi @mohemos Extra info: Hope this helps |
Only issue so far with having the code in WSL is that git kraken is rather sluggish on large projects. You can run an XServer in it and launch GUI from WSL however. |
I am using the WSL 2 and I solved the issue by adding the following env variable: CHOKIDAR_USEPOLLING=true This is how looks like my nodemon command:
Now you can keep WSL2 instead of moving your environment to WSL1. |
I face the same issue here.
Should I download any linux distribution like ubuntu to work with it on windows. When I update any file in the node server, it takes around 3 minutes for nodemon to take into consideration the changes and reload the server and it is long time. The previous version of docker took 30s to reload the server and I can access the app to see the changes. |
Great! We made WSL2 but file system is working slower and file watching is broken :-) |
@slim-hmidi , yeah so I run Ubuntu on WSL2 and have source files for projects etc on the WSL2 file system, it is faster than running it on the Windows side, but that means you also need tools that can work with the wsl path (intelij ide's seems to work ok other than generated files from cli not updating in IDE fast but you can rightclick reload from disk) It does mean I have two installations of gitkraken but im actually trying to use the git that is built-in to intelij/phpstorm more frequently atm which seems to work well. When I ran from windows and volume mapped a directory of source code or other files I watched, to do hot-reload etc it did not work great from windows filesystem side. As mentioned, you can set nodemon to poll, but thats naff as well and doesn't work great if you have a very large project. Alternatively using vscode worked well actually but its not my main ide. |
Your Windows build number: 10.0.18917.1000
What you're doing and what's happening:
I'm running [email protected]
My working directory is located in
/mnt/c/Users/Adam/Documents/...
My
nodemon.json
:I run:
nodemon --delay 1500ms --signal SIGTERM
and then modify a file that is being watched.I'm modifying the file from outside WSL, but I have also tried from within WSL using
nano
.What's wrong / what should be happening instead: After updating to WSL2
nodemon
no longer triggers a restart of my application.I'm able to run
nano ./modified_file.ts
and see the change.In another project built with [email protected] I'm able to run
stencil build --dev --watch --serve
and file modifications trigger a reload.The text was updated successfully, but these errors were encountered: