watchman warning in react native app running through expo
Asked Answered
S

2

7

While running react native app using expo, I am getting this warning on watchman.

watchman warning:  opendir(/Users/saashwath/Library/Caches/CloudKit/com.apple.Safari) -> Operation not permitted. Marking this portion of the tree deleted
To clear this warning, run:
watchman watch-del /Users/saashwath ; watchman watch-project /Users/saashwath

How to remove this warning. Thanking in advance :)

Seismism answered 15/12, 2019 at 17:48 Comment(0)
A
8

Something asked watchman to watch your home directory /Users/saashwath, but the directory /Users/saashwath/Library/Caches/CloudKit/com.apple.Safari is not accessible to the watchman process.

This can sometimes be because something ran under sudo and happens to now be owned by root, or, more likely on macOS, that you didn't allow the watchman process access to some of the directories in your homedir when macOS threw up some prompts like those shown in this GitHub issue: https://github.com/facebook/watchman/issues/658

Now, it normally doesn't make a lot of sense to have watchman watching your home directory, so I'd recommend running this to cancel that watch:

watchman watch-del /Users/saashwath

Watchman won't normally watch that location unless explicitly requested, but in some cases it may decide to aggregate a watched project at what looks like a project boundary. In the default configuration, if you happen to be using git to track your dotfiles in your home directory, that will make your home directory a valid location for watch aggregation.

I would generally recommend against having git try to manage your entire home directory, even outside of this watchman related issue! However, you can also configure your watchman installation to be more restrictive.

If you deploy the following to /etc/watchman.json:

{
  "root_files": [".watchmanconfig"]
}

and restart watchman (watchman shutdown-server ; watchman watch-list), then watchman will only consider projects that have a .watchmanconfig file in them to be valid watchable projects.

I believe that React Native will create a .watchmanconfig at the appropriate place in an app when you set it up, but in case it doesn't, you'll want to create an empty json object in that file to set it up:

echo '{}' > /my/react/project/.watchmanconfig

and that will ensure that your project is watchable.

Alphonsoalphonsus answered 17/12, 2019 at 4:7 Comment(0)
C
3

need to allows watchman from system preference > security and privacy> privacy> full disk accesses > and mark check on watchman with admin access

Crissie answered 23/7, 2020 at 15:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.