为什么在更新到 macOS Catalina 后立即在 react-native 中出现 "Watchman crawl failed" 错误?
Why "Watchman crawl failed" error in react-native immediately after updating to macOS catalina?
尝试 运行 react-native run-ios
或从 xcode 构建 RN 项目,一旦 metro bundler 启动,终端中就会出现此错误:
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 更新之前从未发生过。从一开始,我的项目根目录中就有一个空的 watchman 配置文件。在第一次启动 post-update 时,终端中有一个弹出窗口说了一些关于权限的信息,但我记不清了。在我的终端机 visual studio 代码中也有一个通知说 "the default shell changed to zsh" 运行 chsh -s /bin/zsh
改变,所以我做到了。
我试过:
watchman watch-del-all
watchman server-shutdown
从系统首选项->隐私选项卡中添加对终端的全磁盘访问
npm uninstall watchman
& npm uninstall -g watchman
错误消息表明 /Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA
上存在权限问题。
但是,launchd 可能有点奇怪,所以我建议:
$ 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
更新到 Catalina 后我遇到了同样的问题。 Wez Furlong 的回答对我有用,但我必须向 watchman 提供完整的磁盘访问权限,以便 运行 watchman watch-project 命令不会出现 "Operation not permitted" 错误。作为之前故障排除的一部分,我还提供了对 Xcode 和终端的完整磁盘访问权限(不确定这是否也有助于修复)。
尝试更改项目目录。我在桌面上有我的,但出现了那个错误,移到了主文件夹,错误消失了
要更改 Watchman 对 Documents 文件夹的权限,在系统偏好设置中的安全和隐私 -> 文件和文件夹下
我的问题已通过检查文档文件夹下列表中的 Watchman 得到解决
只需取消选中 Mac 中重复的框即可:
系统偏好设置 -> 安全和隐私 -> 隐私
您需要授予 watchman
磁盘访问权限。为此,您需要:
- 转到
System preferences
> Security & Privacy
然后向下滚动
- Select
Full Disk Access
- 解锁并点击
+
按钮添加新的app/tool
- Select
Macintosh HD
在文件夹列表中
- 同时按下这个组合
shift
Command
.
可以看到所有的目录列表
- 单击
opt > brew > bin
(MacOS Catalina 的 watchman 安装在此文件夹中)|| usr > local > Cellar > Watchman > 21***** > bin
(watchman安装在MacOS Monterey这个文件夹)
- 在列表中查找
watchman
然后 select 它
开始吧,这应该可以解决问题。
你需要改变一些对我有用的东西。仅遵循以下步骤:
1. Go to System preferences > Security & Privacy then scroll down.
2. Select Full Disk Access.
3. Look for all watchmen on the list.
4. check(Mark) all Folders in all watchman files.
5. then go to vs code.
6. rebuilt your code.
I hope it will work smoothly
npx react-native start --port=8088 解决了我的
尝试将您的项目从桌面移动到 Mac 中的用户文件夹中。因为你的桌面没有ruby、守望者等权限
尝试 运行 react-native run-ios
或从 xcode 构建 RN 项目,一旦 metro bundler 启动,终端中就会出现此错误:
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 更新之前从未发生过。从一开始,我的项目根目录中就有一个空的 watchman 配置文件。在第一次启动 post-update 时,终端中有一个弹出窗口说了一些关于权限的信息,但我记不清了。在我的终端机 visual studio 代码中也有一个通知说 "the default shell changed to zsh" 运行 chsh -s /bin/zsh
改变,所以我做到了。
我试过:
watchman watch-del-all
watchman server-shutdown
从系统首选项->隐私选项卡中添加对终端的全磁盘访问
npm uninstall watchman
&npm uninstall -g watchman
错误消息表明 /Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA
上存在权限问题。
但是,launchd 可能有点奇怪,所以我建议:
$ 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
更新到 Catalina 后我遇到了同样的问题。 Wez Furlong 的回答对我有用,但我必须向 watchman 提供完整的磁盘访问权限,以便 运行 watchman watch-project 命令不会出现 "Operation not permitted" 错误。作为之前故障排除的一部分,我还提供了对 Xcode 和终端的完整磁盘访问权限(不确定这是否也有助于修复)。
尝试更改项目目录。我在桌面上有我的,但出现了那个错误,移到了主文件夹,错误消失了
要更改 Watchman 对 Documents 文件夹的权限,在系统偏好设置中的安全和隐私 -> 文件和文件夹下
我的问题已通过检查文档文件夹下列表中的 Watchman 得到解决
只需取消选中 Mac 中重复的框即可:
系统偏好设置 -> 安全和隐私 -> 隐私
您需要授予 watchman
磁盘访问权限。为此,您需要:
- 转到
System preferences
>Security & Privacy
然后向下滚动 - Select
Full Disk Access
- 解锁并点击
+
按钮添加新的app/tool - Select
Macintosh HD
在文件夹列表中 - 同时按下这个组合
shift
Command
.
可以看到所有的目录列表 - 单击
opt > brew > bin
(MacOS Catalina 的 watchman 安装在此文件夹中)||usr > local > Cellar > Watchman > 21***** > bin
(watchman安装在MacOS Monterey这个文件夹) - 在列表中查找
watchman
然后 select 它
开始吧,这应该可以解决问题。
你需要改变一些对我有用的东西。仅遵循以下步骤:
1. Go to System preferences > Security & Privacy then scroll down.
2. Select Full Disk Access.
3. Look for all watchmen on the list.
4. check(Mark) all Folders in all watchman files.
5. then go to vs code.
6. rebuilt your code.
I hope it will work smoothly
npx react-native start --port=8088 解决了我的
尝试将您的项目从桌面移动到 Mac 中的用户文件夹中。因为你的桌面没有ruby、守望者等权限