无法使用守望者:“不允许操作”

oro*_*ome 29 watchman

自从最近更新 Watchman(使用 Homebrew)以来,我无法再使用它来观看项目。我明白了

{
    "version": "2022.05.30.00",
    "error": "std::__1::system_error: open: /Users/Path/To/Project: Operation not permitted"
}

Run Code Online (Sandbox Code Playgroud)

我最初认为这一定是我可以通过正常方式解决的文件访问问题,但让监视程序应用程序访问文件和文件夹并不能解决问题(即使终止所有监视程序进程并重新启动终端)。

为了更好地衡量,我还手动将 watchman 可执行文件添加到全磁盘访问(这是我以前从未需要做的事情,而且对此感到不舒服),但这也没有效果。

我还终止了我能想到的所有相关进程,甚至重新启动了两次。据我所知,自 Watchman 工作以来唯一的brew update watchman变化是我的跑步(当然我也卸载并重新安装)。

一个问题是,由于某种原因,我在系统偏好设置中有多个看守条目,这奇怪地导致需要数十次尝试才能将它们全部进入检查状态以进行访问:

在此输入图像描述

我如何向 Watchman 授予克服此错误所需的权限?

Mik*_* S. 61

在我的 M1 Mac 上:

我的问题是看守人没有~/Documents文件夹权限。不知道重装前还是重装后是这样。以下是我采取的步骤:

brew uninstall watchman
brew install watchman
watchman shutdown-server (just in case it's running)
watchman watch-del-all
yarn start --reset-cache
Run Code Online (Sandbox Code Playgroud)

当我尝试启动 Metro 时,MacOS 提示我授予权限。接受后,捆绑程序运行没有问题。


And*_*jen 22

2022 年 8 月 19 日更新

看起来watchman: stable 2022.08.15.00在我的 Mac M1 上运行良好。启动后,您需要授予对要同步的本地文件夹的访问权限。


原来的

和其他许多人一样,我也遇到了这个问题。

我恢复到“工作”版本,例如 2022.05.16.00

有多种方法可以做到这一点;一种(没有私人水龙头)是:

  1. 卸载看守人
  2. 将 watchman.rb 公式降级到旧版本
  3. 根据该版本安装watchman
  4. 固定它(以防止进一步的守望者更新)
  5. 最后再次将watchman.rb公式重置为原始状态
# -- 1 -- uninstall
brew uninstall watchman
# -- 2 -- replace formula
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/8651d8e23d308e564414188509f864e40548f514/Formula/watchman.rb > /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/watchman.rb
# -- 3 -- install again, using replaced formula
brew install watchman
# -- 4 -- pin that version - Don't forget to unpin once this problem is solved...
brew pin watchman 
# -- 5 -- reset formula to original
cd /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/
git checkout -- watchman.rb
Run Code Online (Sandbox Code Playgroud)

然后关闭 Watchman 的任何延迟实例

watchman shutdown-server
Run Code Online (Sandbox Code Playgroud)

备注:在 Intel-Mac 上,自制程序存储库位于不同的位置。您可以拨打电话了解brew --repository。通常,公式应位于目录中/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula

一旦解决了 watchman 的问题,您可以再次取消 pin watchman 并使用正常的 brew 更新/升级机制。


小智 22

如果服务器和客户端版本不匹配,您可能应该重新启动服务器:watchman shutdown-server ; watchman

https://facebook.github.io/watchman/docs/cmd/version.html