Gulp Watching On Ubuntu Windows

JTS

Real quick tip. I was able to setup Gulp on Ubuntu Windows without any problems. The only issue was that I was unable to get “gulp watch” to work. In the obscure reaches of the internet, I finally the trick.

In your gulpfile.js, modify your watch command to include “usePolling:true”.

Looking at the “Watch” documentation (https://gulpjs.com/docs/en/api/watch/), the usePolling option is defined as:

“When false, the watcher will use fs.watch() (or fsevents on Mac) for watching. If true, use fs.watchFile() polling instead – needed for successfully watching files over a network or other non-standard situations. Overrides the useFsEvents default.”

I guess the Ubuntu Window’s sytem is defined as a “non-standard situation”. Maybe its because Ubuntu Windows is treating the folder structure as a “network” drive (even though I’m hosting it as /mnt/c). Regardless, I’m hoping this saves someone a significant amount of time.


GitHub with my entire file that works:
https://github.com/jtsSTECH/GulpWatchWindows/tree/main

About the author

During his twenty-five professional years, Mr. Silva has had experience in nearly every facet of the Information Technology industry. Ranging from advanced data mining / data visualization systems to running multi-state small business IT infrastructures, Mr. Silva has always provided precise and cost-effective strategies to meet any client’s needs. With his tremendous work ethic and “Can-Do” attitude, Mr. Silva has always met every challenge head-on and with intelligent determination. Mr. Silva is also a certified NAUI Advanced/Nitrox Diver, hoping to get a few more wrecks under his belt in the Atlantic.