Search code examples
gulpwindows-subsystem-for-linuxgulp-watch

Gulp Watch does not work on Windows Subsystem for Linux 2 (WSL 2)


I am working on a project on WSL 2 in windows. The project uses node to only compile sass and minify js. I have saved the project files on my Windows File System. I access the project files and run the project using Ubuntu on WSL 2. Everything works fine except gulp watch. I use VSCode as text editor. I have configured gulp watch properly to recompile sass files on changes but it does not seem to do that. On running the gulp watch, watch starts but on making any change, the SASS files are not compiled.


Solution

  • This is because of the way WSL 2 works. File changes made by Windows apps on Windows filesystem don't trigger notifications for Linux apps. This issue is currently open on GitHub at this link.

    To make it work, store your project files in the home directory on Linux filesystem (cd ~ will take you to home directory). Run gulp watch again and you should be good to go !!!