最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Error received: "unable to resolve root". How to grant access to watchman? - Stack Overflow

programmeradmin5浏览0评论

I installed a react-native starter project and when running, it asked to grant permission to watchman to access my system's files. I naively declined, but now I get the following error whenever trying to run the folder:

Error: unable to resolve root /Users/ckoong/Desktop/Repos/rn-starter: failed to opendir(/Users/ckoong/Desktop/Repos/rn-starter): Operation not permitted
    at BunserBuf.<anonymous> (/Users/ckoong/Desktop/Repos/rn-starter/node_modules/fb-watchman/index.js:95:23)
    at BunserBuf.emit (events.js:315:20)
    at BunserBuf.process (/Users/ckoong/Desktop/Repos/rn-starter/node_modules/bser/index.js:292:10)
    at /Users/ckoong/Desktop/Repos/rn-starter/node_modules/bser/index.js:247:12
    at processTicksAndRejections (internal/process/task_queues.js:75:11)
Emitted 'error' event on WatchmanWatcher instance at:
    at Client.<anonymous> (/Users/ckoong/Desktop/Repos/rn-starter/node_modules/jest-haste-map/build/lib/WatchmanWatcher.js:130:10)
    at Client.emit (events.js:315:20)
    at BunserBuf.<anonymous> (/Users/ckoong/Desktop/Repos/rn-starter/node_modules/fb-watchman/index.js:107:12)
    at BunserBuf.emit (events.js:315:20)
    at /Users/ckoong/Desktop/Repos/rn-starter/node_modules/bser/index.js:249:12
    at processTicksAndRejections (internal/process/task_queues.js:75:11) {
  watchmanResponse: {
    version: '4.7.0',
    error: 'unable to resolve root /Users/ckoong/Desktop/Repos/rn-starter: failed to opendir(/Users/ckoong/Desktop/Repos/rn-starter): Operation not permitted'

I've seen various people saying to grant access to watchman in system preferences, however, when searching in the window, I'm not seeing any reference to watchman anywhere on my system.

I'm working on Big Sur.

Please assist.

I installed a react-native starter project and when running, it asked to grant permission to watchman to access my system's files. I naively declined, but now I get the following error whenever trying to run the folder:

Error: unable to resolve root /Users/ckoong/Desktop/Repos/rn-starter: failed to opendir(/Users/ckoong/Desktop/Repos/rn-starter): Operation not permitted
    at BunserBuf.<anonymous> (/Users/ckoong/Desktop/Repos/rn-starter/node_modules/fb-watchman/index.js:95:23)
    at BunserBuf.emit (events.js:315:20)
    at BunserBuf.process (/Users/ckoong/Desktop/Repos/rn-starter/node_modules/bser/index.js:292:10)
    at /Users/ckoong/Desktop/Repos/rn-starter/node_modules/bser/index.js:247:12
    at processTicksAndRejections (internal/process/task_queues.js:75:11)
Emitted 'error' event on WatchmanWatcher instance at:
    at Client.<anonymous> (/Users/ckoong/Desktop/Repos/rn-starter/node_modules/jest-haste-map/build/lib/WatchmanWatcher.js:130:10)
    at Client.emit (events.js:315:20)
    at BunserBuf.<anonymous> (/Users/ckoong/Desktop/Repos/rn-starter/node_modules/fb-watchman/index.js:107:12)
    at BunserBuf.emit (events.js:315:20)
    at /Users/ckoong/Desktop/Repos/rn-starter/node_modules/bser/index.js:249:12
    at processTicksAndRejections (internal/process/task_queues.js:75:11) {
  watchmanResponse: {
    version: '4.7.0',
    error: 'unable to resolve root /Users/ckoong/Desktop/Repos/rn-starter: failed to opendir(/Users/ckoong/Desktop/Repos/rn-starter): Operation not permitted'

I've seen various people saying to grant access to watchman in system preferences, however, when searching in the window, I'm not seeing any reference to watchman anywhere on my system.

I'm working on Big Sur.

Please assist.

Share Improve this question edited Feb 14, 2022 at 12:33 Genetic1989 asked Feb 13, 2022 at 19:34 Genetic1989Genetic1989 6341 gold badge7 silver badges19 bronze badges 3
  • I personally did not encounter this issue, but I read about it here and maybe it is useful (long story short: remove watchman and install it again) github./facebook/react-native/issues/… – dianaqqq Commented Feb 17, 2022 at 9:19
  • Are you using MacOS? – David Scholz Commented Feb 20, 2022 at 22:05
  • in a shell try to grant 777 permissions with this mand "sudo chmod 777 -R /Users/ckoong/Desktop/Repos/rn-starter" (777 no es the best option but could help you...) – clay Commented Feb 21, 2022 at 18:32
Add a ment  | 

4 Answers 4

Reset to default 6

adding a .watchmanconfig file in the root and putting a {} inside it has worked for me

As with @Fraser's answer You must grant Full Disk Access to watchman. Go to System Preferences -> Security & Privacy -> Privacy tab -> scroll down and click Full Disk Access Check off

  • Terminal
  • sh or Watchman (Mine showed only sh)

Then run watchman watch <dir> and start the app

Go to System Preferences -> Security & Privacy -> Privacy tab -> scroll down and click Full Disk Access, and then check Watchman.

I had the project in the ~/Documents folder. I moved it elsewhere and it worked. I think the same issue applies to ~/Desktop folder. source

发布评论

评论列表(0)

  1. 暂无评论