Using WSL 2 here with Ubuntu 20.04, hugo v0.74.3. I found this issue by googling, so, if you’re here with a similar issue, try this workaround.
One of OPs main concerns seems to have been how the hugo server
wouldn’t rebuild (and livereload) on changes in the project directory.
I also had this issue while trying to run the server in a project that resided on the Windows mount of filesystem (e.g. /mnt/c/Users/tim/code/myblog/
. After starting the server and making changes, the expected log output did not show up. No changes, no rebuilds, etc.
Moving the project onto the Linux filesystem fixed that (e.g /home/tim/code/myblog
) for me. After doing so, Hugo logged about seeing changes and rebuilded as expected.
Now for some speculation:
Filesystem change/watch events (what hugo serve
looks for with fsnotify) are low-level and OS-specific, and it seems WSL does not yet provide the same kind of environment/functionality for it’s Windows files into the Linux kernel (yet).
Digging a little more into fsnotify, but also while knowing very little about Go, I see they are considering OS-agnostic “polling” with watcher. Maybe if that feature happens, Hugo can choose to use it (or be configured by users to) and solve this issue here for us.