windows-subsystem-for-linuxwsl-2watchinotify

Development tools won't watch for changes in WSL2


I'm using a development tool that should rebuild/update/etc. when the source files change, but this is not happening when running the tool in Windows Subsystem for Linux (WSL2). Why, and what can I do to fix it?


Note that there are a number of questions here on Stack Overflow with the same root issue, but each question focuses on a different development tool. This is designed to be a canonical question with a Community-wiki answer that is common to all tools. Note that some tools may have additional, tool-specific answers as well which should be posted on their own questions.

Links to tool-specific questions:


Solution

  • The core issue is that the inotify API is not supported by the Plan 9 (9P) network filesystem used by WSL2 to access Windows drives. This impacts things like tail as well as "hot reload" features in many development tools (e.g., npm watch).

    This occurs in WSL2 when:

    Normal workarounds: