Watchman crawl failed. Retrying once with node crawler
Asked Answered
D

19

78

Watchman crawl failed. Retrying once with node crawler. Usually this happens when watchman isn't running. Create an empty .watchmanconfig file in your project's root folder or initialize a git or hg repository in your project.

Error: watchman --no-pretty get-sockname returned with exit code=1, signal=null, stderr= 2018-03-23T11:33:13,360: [0x7fff9755f3c0] the owner of /usr/local/var/run/watchman/root-state is uid 501 and doesn't match your euid 0

Depreciate answered 23/3, 2018 at 6:5 Comment(0)
X
32

You're running watchman as root but the state dir, which may contain trigger definitions and thus allow spawning arbitrary commands, is not owned by root. This is a security issue and thus watchman is refusing to start.

The safest way to resolve this is to remove the state dir by running:

rm -rf /usr/local/var/run/watchman/root-state

I'd recommend that you avoid running tools that wish to use watchman using sudo to avoid this happening again.

Xanthophyll answered 25/3, 2018 at 3:36 Comment(3)
What about windows OS. I get this error on windows too.Castiglione
you don't have the same issue as the OP because the Windows version of watchman doesn't have this same check. I'd recommend that you reach out to the React Native folks for assistance.Xanthophyll
Thanks. I got this error in Android Studio, and was running as root to upgrade the program. Closing Studio and opening again not as root seems to have solved it for me. I was building a React Native app.Isometrics
L
267

Testing with jest:

Step 1:

watchman watch-del-all

Step 2:

watchman shutdown-server
Lesbian answered 7/4, 2022 at 9:50 Comment(7)
I tried all the solutions from the GitHub issue page but none of them worked. Then I came to the StackOverflow solution and its first answer worked. Thanks to its Trending Sort functionality and you @Jeffox.Oviduct
This worked for me, on mac, but only after I first uninstalled watchman and then reinstalled it.Solemnize
After OS updates on macos, watchman needs admin privileges to work again. watchman shutdown-server helped to ask the access to my documents and to have watchman working again.Kwei
The issue comes back after opening a new session, so the above commands, while they do make the warning go away, only work temporarily (running from inside an IDE)...Exude
This command worked for me. I am on M1 MacLeven
For me as well, on mac M1 this command fixed it, thanks!Mclyman
Thanks, this command worked and fixed it.Ormand
X
32

You're running watchman as root but the state dir, which may contain trigger definitions and thus allow spawning arbitrary commands, is not owned by root. This is a security issue and thus watchman is refusing to start.

The safest way to resolve this is to remove the state dir by running:

rm -rf /usr/local/var/run/watchman/root-state

I'd recommend that you avoid running tools that wish to use watchman using sudo to avoid this happening again.

Xanthophyll answered 25/3, 2018 at 3:36 Comment(3)
What about windows OS. I get this error on windows too.Castiglione
you don't have the same issue as the OP because the Windows version of watchman doesn't have this same check. I'd recommend that you reach out to the React Native folks for assistance.Xanthophyll
Thanks. I got this error in Android Studio, and was running as root to upgrade the program. Closing Studio and opening again not as root seems to have solved it for me. I was building a React Native app.Isometrics
G
19

As Jodie suggested above I tried the below and it worked well, for the benefit of others mentioning below steps which I tried in my mac to fix this issue

  1. First, Kill all the server running and close your terminal.
  2. Go to 'System preferences' -> 'Security & Privacy' -> privacy tab
  3. Scroll down and click 'Full Disk Access'
  4. Make sure you checked on 'Terminal' and 'Watchman'.
  5. Now relaunch terminal and simply try running again it works!!
Gyn answered 13/10, 2020 at 4:17 Comment(4)
Watchman isn't in the list there for me. Any thoughts?Tyler
Same, can't locate Watchman in 'Full Disk Access' - the watchman.rb file is greyed out when searching manually.Brezin
any updates on this? I also am unable to get watcman to show up in the listDisguise
to the people not able to locate watchman, go to the usr/local/cellar/watchman/22.XXXXX/bin/watchmanAmbient
F
7
  1. watchman watch-del-all

  2. watchman shutdown-server

Worked on MAC with no problem.

Frequentation answered 7/4, 2023 at 15:19 Comment(2)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Retribution
help me, thank you! was switching between 3 RN projects, and restarting watchman server fix this issueExotic
A
6

-June 8 2022

Giving Full Disk Access to all terminals or where you're getting started your server, is fixed the error. Also, it would be good to give access (Files and Folders) to VSC.

Here are the steps to do it!

  1. Open System Preferences

enter image description here

  1. Find Security & Privacy option and open it

enter image description here

  1. Give Full Disk Access to your terminals, Xcode and VSC.

enter image description here

Happy Hacking!!!

Ansilme answered 8/6, 2022 at 10:51 Comment(2)
Your answer can be improved by adding additional information. You should provide step by step procedures to reach the "Full Disk Access" option and accomplishing the whole setting process. That would help much to anyone reading your answer.Ambassador
Additional Step - On click Security & Privacy , Got to Privacy Tab .Scroll down to see Full Disk accessStandish
H
6

This error started to me when I ran the command npx react-native-clean-project, and with this step mentioned above, my case was solutioned.

Step 1:

watchman watch-del-all

Step 2:

watchman shutdown-server
Historical answered 6/10, 2023 at 19:7 Comment(0)
E
3

I had a real issue with this one but finally found the answer.

Here's a screenshot of the post that helped me.

https://github.com/facebook/watchman/issues/751#issuecomment-542300670

The whole forum has multiple different solutions which I hadn't actually tried, but this one is the solution that worked for me! Hope this helps.

Erin answered 2/3, 2020 at 11:15 Comment(1)
Welcome to Stack Overflow! While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.Tore
M
3

check for .watchmanconfig and add this {}.

Inside the file .watchmanconfig

{}

Simple as that just try it.

Mistake answered 2/12, 2022 at 20:40 Comment(0)
S
2

I solved this, on linux by using the following commands on terminal.

$ echo 256 | sudo tee -a /proc/sys/fs/inotify/max_user_instances

$ echo 32768 | sudo tee -a /proc/sys/fs/inotify/max_queued_events

$ echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches

$ pkill node

Then:

$ npm start

or

$ expo start (if you are using expo)
Suzan answered 6/8, 2020 at 15:21 Comment(0)
S
2
watchman watch-del-all && rm -f yarn.lock && rm -rf node_modules && yarn && yarn start -- --reset-cache
Spriggs answered 13/5, 2022 at 18:42 Comment(1)
why would deleting your node_modules and yarn.lock help?Leschen
T
2

If you're not actually using watchman with Jest just set watchman: false in your jest.config.js to stop this message when running tests.

Threap answered 15/4, 2023 at 18:7 Comment(0)
P
1

Step 1: $ npm cache clean --force

Step 2: Delete node_modules: $ rm -rf node_modules

Step 3: npm install

Step 4? (Optional): yarn start / npm start

This worked for me. Hopes it works for you too.

Pterosaur answered 9/10, 2021 at 12:11 Comment(0)
C
1

A quick solution is to kill watchman server by entering this command line in your terminal:

watchman shutdown-server
Crenellate answered 27/10, 2023 at 10:47 Comment(0)
M
0

On a Mac, remove all watches and associated triggers of running process, then shutdown the service. See screenshot below: enter image description here

Manchester answered 6/5, 2022 at 11:18 Comment(0)
S
0

Put your project in a shared folder (ie, Macintosh HD/Users/Shared. I kept getting operation denied on the Desktop, because of further protection policies, even though Full Disk Access was granted.

Shovelboard answered 20/6, 2022 at 13:11 Comment(0)
H
0

To solve this issue on my end, i had to stop the other node instance running on my other terminal. Just make sure you don't have another node running on your machine.

Holm answered 5/10, 2022 at 8:34 Comment(0)
P
0

Watchman config file

I set my .watchconfig file to be extra permissible: Add this code to your .watchmanconfig file


{
  "ignore_dirs": [],
  "fsevents_latency": 0.5,
  "fsevents_try_resync": true
}
Prefatory answered 13/2, 2023 at 12:8 Comment(0)
N
0

// In jest.config.js, set watchmen to false.

module.exports = {
  //other options ...
  watchman: false,
};
Newspaperman answered 16/7, 2023 at 5:12 Comment(0)
C
0

The simplest way is to kill watchman server using the following command line:

watchman shutdown-server

Then you can remove the recored files changes using this command:

watchman watch-del-all

That's all.

Crenellate answered 14/4 at 16:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.