question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
resonancedesignscommented, Feb 10, 2022

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.

Image 1

2reactions
wazpcommented, Oct 14, 2021

I think this might be related to inotify not 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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found