CocoaPods无法找到兼容的Firebase/Messaging版本问题求助
CocoaPods Firebase/Messaging版本冲突解决
问题详情
执行pod install时出现版本冲突报错:
[!] CocoaPods could not find compatible versions for pod "Firebase/Messaging": In snapshot (Podfile.lock): Firebase/Messaging (= 10.19.0) In Podfile: RNFBMessaging (from `../node_modules/@react-native-firebase/messaging`) was resolved to 18.8.0, which depends on Firebase/Messaging (= 10.20.0)
项目核心依赖:
"dependencies": { "@react-native-firebase/app": "^18.7.3", "@react-native-firebase/messaging": "^18.7.3", // 其他依赖省略 }
已尝试pod install、pod install --repo-update、pod update FirebaseCoreExtension、pod update Firebase/Messaging及手动修改Podfile.lock,均未解决问题。
解决步骤
1. 统一React Native Firebase包版本
尽管package.json中@react-native-firebase/app和messaging版本标注一致,但缓存可能导致实际安装版本不符,需清理后重装:
# 回到项目根目录 rm -rf node_modules package-lock.json yarn.lock npm install # 或使用 yarn install,根据你的包管理器选择
2. 彻底清理CocoaPods缓存
进入iOS目录,删除旧的Pod依赖和锁文件:
cd ios rm -rf Podfile.lock Pods pod deintegrate pod repo update
3. 重新执行pod安装
确保Podfile中未手动指定Firebase版本,执行:
pod install
4. 强制更新Firebase相关Pod(若上述步骤无效)
如果冲突仍存在,强制更新所有Firebase相关组件:
pod update Firebase Firebase/Messaging --no-repo-update
内容的提问来源于stack exchange,提问作者Eportal
相关产品推荐
相关产品推荐

