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

Jeremy T. Silva, owner of Silva Tech Solutions

About the author

Jeremy T. Silva is the owner of Silva Tech Solutions and works as a fractional CIO for mid-market manufacturers, engineering firms, and service companies across Eastern Pennsylvania and New Jersey. He sets technology strategy, governs AI adoption, and holds vendors accountable, without reselling products or taking referral fees. He has twenty-five years of IT leadership experience, including director-level roles in healthcare and corporate events.