更新到macOS catalina之后,为什么立即在本机中出现“ Watchman抓取失败”错误?

时间:2019-10-10 08:16:02

标签: react-native terminal react-native-android react-native-ios watchman

尝试运行react-native run-ios或从xcode构建RN项目时,都会捆绑程序启动后,此错误就会出现在终端中:

Loading dependency graph...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: resolve_projpath: path `/Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA`: open: /Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA: Operation not permitted. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.html.
events.js:183
      throw er; // Unhandled 'error' event
  ^

Error: resolve_projpath: path `/Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA`: open: /Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA: Operation not permitted
    at BunserBuf.<anonymous> (/Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA/node_modules/fb-watchman/index.js:95:23)
    at emitOne (events.js:116:13)
    at BunserBuf.emit (events.js:211:7)
    at BunserBuf.process (/Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA/node_modules/bser/index.js:292:10)
    at /Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA/node_modules/bser/index.js:247:12
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

这在Catalina更新之前从未发生过。从一开始,我的项目根目录中就有一个空的守望者配置文件。在第一次启动后更新时,终端中弹出一个窗口,提示有关权限的信息,但我记不清了。我的终端在Visual Studio代码中也有一条通知,说“默认的shell更改为zsh”运行chsh -s /bin/zsh进行更改,所以我做了。

我尝试过:

  • watchman watch-del-all

  • watchman server-shutdown

  • 从系统偏好设置->“隐私”标签中添加对终端的完整磁盘访问权限

  • npm uninstall watchmannpm uninstall -g watchman

5 个答案:

答案 0 :(得分:2)

更新为Catalina之后,我遇到了同样的问题。 Wez Furlong的答案对我有用,但是我必须提供对watchman的完整磁盘访问权限,才能运行watchman watch-project命令,而不会出现“不允许操作”错误。作为以前的疑难解答的一部分,我还提供了对Xcode和Terminal的完整磁盘访问权限(不确定是否也有助于修复)。

答案 1 :(得分:2)

要更改Watchman关于Documents文件夹的权限,请在系统偏好设置中的“安全和隐私->文件和文件夹”下

我的问题已通过在“文档”文件夹下的列表中检查Watchman得以解决

答案 2 :(得分:1)

该错误消息表示对/Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA的权限问题。

但是,它的发布可能有点时髦,所以我建议:

$ watchman shutdown-server
$ launchctl unload ~/Library/LaunchAgents/com.github.facebook.watchman.plist
$ rm ~/Library/LaunchAgents/com.github.facebook.watchman.plist
$ watchman watch-project /Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA

并查看它是否有效或显示更多上下文。

交叉链接回我们的GitHub跟踪器中的问题: https://github.com/facebook/watchman/issues/751

答案 3 :(得分:0)

尝试更改项目的目录。我在台式机上遇到了我,并收到了该错误,将其移至主文件夹,该错误消失了

答案 4 :(得分:0)

只需在 Mac 中取消选中重复框:

系统偏好设置 -> 安全和隐私 -> 隐私

enter image description here