You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级React Native至0.66.2后执行pod install失败求助

解决React Native 0.66.2升级后iOS pod install找不到React-perflogger的问题

我刚帮几个开发者处理过RN 0.66.2升级后的这个Pod依赖问题,结合你提供的Podfile和报错信息,给你整理了一套针对性的解决方案:

问题回顾

你升级React Native到0.66.2后,执行pod install时遇到了这个关键错误:

[!] Unable to find a specification for React-perflogger (= 0.66.2) depended upon by React-Core

虽然已经把Folly改成了RCT-Folly,但问题依然存在——这是因为RN 0.66版本对核心依赖的引入逻辑做了调整,React-perflogger需要显式在Podfile中声明。

分步解决指南

1. 先彻底清理旧依赖与缓存

旧缓存经常会导致各种Pod安装问题,先执行以下命令清理环境:

# 回到项目根目录,删除node_modules和锁文件
rm -rf node_modules package-lock.json yarn.lock
# 重新安装项目依赖
npm install # 用yarn的话就执行 yarn install
# 进入iOS目录清理Pod相关文件
cd ios
rm -rf Pods Podfile.lock
# 清空CocoaPods本地缓存
pod cache clean --all

2. 修改Podfile,添加React-perflogger的引入

打开你的Podfile,在React核心依赖的区块中,添加React-perflogger的路径声明——它在RN包的ReactCommon/reactperflogger目录下:

# 放在已有的React-Core、React-jsi等pod配置之后
pod 'React-perflogger', :path => '../node_modules/react-native/ReactCommon/reactperflogger'

同时确认你已经正确配置了RCT-Folly(你当前的配置是对的,不用改):

pod 'RCT-Folly', :podspec => '../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'

3. 强制更新Pod仓库并重新安装

执行带仓库更新的pod install,确保CocoaPods拉取到最新的依赖规格:

pod install --repo-update

4. 兜底检查:确认RN包完整性

如果还是有问题,可能是升级过程中RN包文件缺失,重新安装指定版本的RN:

# 回到项目根目录执行
npm install react-native@0.66.2 --save-exact

验证结果

完成以上步骤后,再次进入iOS目录执行pod install,应该就能顺利安装所有依赖,不会再出现React-perflogger找不到的错误了。


内容的提问来源于stack exchange,提问作者Bob Steel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.01 02:02:43