Nodemon not restarting (not recognising file changes) in WSL2 - Ubuntu-18.04, when project directory is in Windows filesystem.
See original GitHub issue- Versions: node@v16.7.0, linux@5.10.16.3-microsoft-standard-WSL2
nodemon -v: 2.0.12- Command you ran:
nodemon app.js
Expected behaviour
When I change something (adding console.log('')) to app.js the server should restart.
Actual behaviour
Nodemon doesn’t do anything
Things to note
This worked last night, and when I logged back on to my PC this morning, it’s just stopped registering file changes. I’m at a real loss here.
❯ nodemon app.js
[nodemon] 2.0.12
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node app.js`
NodeJS server started!
And that’s it. I can run rs, to manually restart the node server, which works fine:
rs
[nodemon] starting `node app.js`
NodeJS server started!
But no matter which file, how many, or how much I change a file, there’s no automatic restarts.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:8 (4 by maintainers)
Top Results From Across the Web
How can nodemon be made to work with WSL 2?
Longer answer: · 1 · I did cd $HOME/Projects/testserver and then ran nodemon without -l , but it didn't recognize file changes again....
Read more >download directory from ftp server Code Example
'react-scripts' is not recognized as an internal or external command, operable program or batch file. ... Zsh is not installed. Please install zsh...
Read more >Nodemon won't hot reload on WSL ... - Reddit
The Problem is most likely WSL not nodemon. The Windows drive gets mounted into WSL. But the detection of file changes get lost...
Read more >WSL: cannot stop nodemon process from Webstorm - YouTrack
IDE runs the process as ubuntu.exe run "nodemon timer.js" (roughly) with redirected streams. Due to https://github.com/Microsoft/WSL/issues/3766, nodemon ...
Read more >sitemap-questions-1.xml - Ask Ubuntu
... 2021-09-15 https://askubuntu.com/questions/1363830/cannot-boot-windows-10-from-grub-after-installing-ubuntu-20-04 2021-09-15 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I can replicate this on my system with what I believe is in a similar WSL2 environment, I had the same issue. A simple work-around for me was to add the -L (legacy watch) argument to the command.
I think this might be related to
inotifynot working between the linux filesystem and windows right now. There’s an open bug about it over at the WSL repo: https://github.com/microsoft/WSL/issues/4739