warning: Watchman `watch-project` returned a warning: Recrawled this watch X times, most recently because
Asked Answered
P

1

18
warning: Watchman `watch-project` returned a warning: Recrawled this watch 11 times, most recently because:
MustScanSubDirs UserDroppedTo resolve, please review the information on
https://facebook.github.io/watchman/docs/troubleshooting.html#recrawl
To clear this warning, run:
`watchman watch-del '/path/to/my/project' ; watchman watch-project '/path/to/my/project'`

I'm constantly getting this warning when starting Metro (e.g. react-native start).

I know the question has been asked before and the consensus is to run the following (as the warning also suggests):

watchman watch-del '/path/to/my/project' ;
watchman watch-project '/path/to/my/project'

This command does make it go away temporarily, however it comes back again in a few hours/next day. So it's never a solution, just a workaround. I'm on macOS 13.4 and also gave watchman full disk access, but that doesn't change anything either. Also, even if it worked, giving a command line tool full disk access (whereas it just should be accessing my project directory inside Documents) doesn't feel right from a security point of view anyway.

I also need watchman while working with React Native, so simply removing it also isn't an option (one of the questions had that as an "answer", hence the mention).

Why has this been happening for years now, and how can I get rid of this warning permanently?

Potluck answered 13/6, 2023 at 18:5 Comment(7)
Take a look at the various fsevent configuration items here. There are unlikely to be any silver bullets; you'll need to explore what works for your project / use-case. I've had success with fsevents_try_resync, but as noted in the description: "There are possible undiagnosed correctness issues with this setting." 🀷 – Goulette
@Goulette but I don't get it.. what is the official way of solving this? React Native needs watchman, which creates these problems "out of the box" on macOS. we shouldn't be tinkering with internals, especially if we don't know what we are doing (and TBH I don't, when it comes to fsevents/watchman etc). I just need to focus on my RN project, not file system configurations. – Sprinkle
@Goulette of course I'm not saying this "to you", I was just explaining the situation, just in a reply to your comment. otherwise, thank you for the comment, I'm reading the link regardless! :) – Sprinkle
Ha, no stress, I understand your frustrations; for the most part I just learned to treat watchman issues as noise and move on, either through judicious use of watchman watch-del-all in my scripts or just ignoring it 🀣 For what it's worth, I think the warning is just that, a warning, so ignoring it is viable. – Goulette
@Goulette something I think fast refresh doesn't work if I started getting that warning, well, too many times (e.g. recrawled 5+ times). don't know if it's the reason or just a coincidence with something else though. Perhaps I will add watchman watch-del-all to my yarn start script. – Sprinkle
This might work: github.com/facebook/watchman/issues/981#issuecomment-1026249636 – Greed
@Greed that doesn't "work". it only makes the issue go away for a few hours. – Sprinkle
C
13

First Stop the Metro by:

 ctrl + c

then run this command,

watchman watch-del-all   //this removes or deletes all current listening watchman

then,

 npm start
Certiorari answered 18/3 at 11:18 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.