react native 运行iOS时出现错误:Error: jest-haste-map: Watchman crawl failed. Retrying once with node crawler. 进过查证有以下几种可能:
由 brew 安装的 watchman 版本过高,所以降低版本即可
- 先卸载
brew uninstall watchman - 再安装
brew install watchman <#需要的版本#>
由于系统升级导致watchman 对 Documents 下文件读取权限丢失导致,所以需要重新授权
- 经过设置路径: System Preferences > Security & Privacy > Privacy > Files and Folders
- 将
watchman添加进去
RN 项目根目录下缺少 .watchmanconfig 文件,所以重新创建一个
- 在项目根目录下创建文件
touch .watchmanconfig - 在
.watchmanconfig中添加内容{}
watchman 文件有损坏,重装一下
- 先卸载
brew uninstall watchman - 再安装
brew install watchman
使用 port 替代 brew 安装 watchman
我的这次报错就是用此方法修复的
- 先卸载
brew uninstall watchman - 安装
port, 下载安装port - 使用
port安装watchman,sudo port install watchman