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

升级React Native 0.69.3时iOS端无法安装CocoaPods的问题

React Native 0.69.3 iOS pod install失败:找不到React-Codegen (=0.69.3) 解决方案

报错信息

suresh ios % pod install
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
[Codegen] Found FBReactNativeSpec
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
RNFBAnalytics: Using default Firebase/Analytics with Ad Ids. May require App Tracking Transparency. Not allowed for Kids apps.
RNFBAnalytics: You may set variable `$RNFirebaseAnalyticsWithoutAdIdSupport=true` in Podfile to use analytics without ad ids.
Fetching podspec for `boost` from `../node_modules/react-native/third-party-podspecs/boost.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`

[!] Unable to find a specification for `React-Codegen (= 0.69.3)` depended upon by `React-RCTSettings`

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

解决步骤

1. 更新CocoaPods源

优先执行报错提示的方案,更新本地CocoaPods仓库:

pod repo update
# 或者直接带更新参数执行pod install
pod install --repo-update

2. 检查Podfile配置

确保Podfile开头正确引入React Native的Pod脚本,无关键配置缺失:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

不要手动修改React-RCTSettings或React-Codegen的版本号,保持与React Native主版本一致。

3. 清理缓存并重新安装依赖

清理所有可能的缓存和残留文件,从头开始安装:

# 清理CocoaPods缓存
pod cache clean --all
# 删除iOS目录下的Pods文件夹和Podfile.lock
rm -rf Pods Podfile.lock
# 删除项目根目录的node_modules并重新安装npm/yarn依赖
rm -rf node_modules && npm install
# 最后重新执行pod install
pod install

4. 检查版本一致性

  • 确认package.json中react-native版本确实为0.69.3,无版本不匹配情况
  • 检查第三方依赖库是否适配RN 0.69.x,部分老库可能未兼容新的Codegen机制,需升级对应库版本

5. 手动指定React-Codegen路径(兜底方案)

若以上方法无效,在Podfile中手动指定React-Codegen的本地podspec路径:

pod 'React-Codegen', :path => '../node_modules/react-native/ReactCommon/react-codegen'

添加后重新执行pod install

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.25 05:15:46