watchman: Operation not permitted

Try to build react native clear project and getting watchman error:

jest-haste-map: 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 error: std::__1::system_error: open: /Users/sliokkory/Documents/myteam/star: Operation not permitted. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.

Watchman -v: 2021.11.15.00 MacOs: 12.0.1 Monterey (m1)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 7
  • Comments: 57

Most upvoted comments

First run watchman watch-del-all then run watchman shutdown-server fixed my issue

Hi. You should move the entire project directory outside of the Documents directory

First run watchman watch-del-all then run watchman shutdown-server fixed my issue

FIXED!

Is there a permanent fix for this? Moving my project to another folder is not a fix.

I had my project inside Documents folder too and was receiving the same error as the OP when I ran npx react-native start

As mentioned by someone else, it happens due to macOS making Documents directory private by default.

To fix the issue, I did the following:

  1. Run sudo npx react-native start
  2. When asked if you want to give your terminal app access to Documents folder, allow it.
  3. Now you will see that it is working as expected. It means that you can quit the command with Ctrl + C.
  4. From now on you can (and preferably should) use npx react-native start

Hope it helps others.

Privacy & Security -> Files and Folders image

Просто перенес в корень, и то-же сработало

Yep have to be right under Users/myuser/ directory. If you placed them under other folders it still not working for example Users/myuser/Download/

No, it’s permanent. System forbid access to Documents folder. It’s security issue otherwise. Maybe there is a possibility to give a permissions, but I wouldn’t do that

Is this something that has been changed recently or just specific for M1 chips because i have always been working on react native apps and using it inside my documents folder but just today, It appeared that i got that error too?

For me it worked with moving the project directory to Users/myuser/

watchman watch-del-all them run watchman shutdown-server after finish these two command

just type npm start and accept watchman permission allow

First run watchman watch-del-all then run watchman shutdown-server fixed my issue

Works for me!

Privacy & Security -> Files and Folders image

Thank you man. This worked for me.

@SufianBabri Ok, if you filling good about allowing permissions which are not supposed to be allowed, that could be a solution. As for me moving the project somewhere outside of document folder is better idea.

First run watchman watch-del-all then run watchman shutdown-server fixed my issue

This worked for me. Thanks

If you are using mac go to setting > Privacy & Setting > Full Disk Access > Allow Watchman and Terminals

watchman watch-del-all them run watchman shutdown-server after finish these two command

just type npm start and accept watchman permission allow

Exactly this. For whatever reason Watchman had lost it’s permission to access my desktop/apps folder. This just allowed me to re-grant permission.

brew upgrade watchman fixed my issue

We can resolved this when we put our project outside from those folder Desktop,Download and Document then run

npm start

It will be work thanks

It didn’t work until I allowed sh to access the disk.

After a bit more research i found this issue where it has a temp fix https://github.com/facebook/watchman/issues/1030#issuecomment-1145766948

Hi. You should move the entire project directory outside of the Documents directory

This worked for me too 😃 I tried adding access to watman executable via System Preferences but couldnt manage to do it. but this worked perfectly.

First run watchman watch-del-all then run watchman shutdown-server fixed my issue

Wow this solutions worked for me great

sometime watchman is not able to access your folder where your actual project is located so for that reason it shows Operation not permitted to resolve this issue

  1. run sudo npx react-native start so it will start the server
  2. when the server is started, a popup appears that allows access to the folder for watchman allows it.
  3. then run your project in Android/IOS it will run as expected.

Privacy & Security -> Files and Folders image

Thank you! Works for me!

First run watchman watch-del-all then run watchman shutdown-server fixed my issue

Yesss!! Thanks Bro!!!

First run watchman watch-del-all then run watchman shutdown-server fixed my issue

THANK YOU!

First run watchman watch-del-all then run watchman shutdown-server fixed my issue

This works.

Hi. You should move the entire project directory outside of the Documents directory

This is dumb; but it worked

No, it’s permanent. System forbid access to Documents folder. It’s security issue otherwise. Maybe there is a possibility to give a permissions, but I wouldn’t do that