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

CocoaPods无法找到兼容版本的Firebase/CoreOnly依赖问题求助

解决CocoaPods无法找到Firebase/CoreOnly兼容版本的问题

核心原因

你的项目同时混用了**@react-native-firebase/*(v15.7.0)和expo-firebase-core**两个Firebase的React Native集成方案,它们依赖的iOS Firebase SDK版本不一致,导致CocoaPods无法解析出兼容的版本组合。

解决步骤

1. 统一Firebase集成方案

因为项目基于Expo,建议统一使用Expo官方的Firebase相关库,移除冲突的@react-native-firebase依赖:

  • 从package.json中删除以下依赖:
    "@react-native-firebase/app": "^15.7.0",
    "@react-native-firebase/auth": "^15.7.0",
    "@react-native-firebase/messaging": "^15.7.0"
    
  • 添加Expo对应的Firebase库(版本需匹配Expo 45的要求,Expo 45对应的Firebase库版本为14.x):
    "expo-firebase-app": "~14.1.0",
    "expo-firebase-auth": "~14.1.0",
    "expo-firebase-messaging": "~14.1.0"
    

2. 清理依赖与缓存

执行以下命令彻底清理旧依赖和缓存:

  • 删除本地依赖文件:
    rm -rf node_modules package-lock.json yarn.lock
    
  • 重新安装npm/yarn依赖:
    npm install
    # 或使用yarn
    yarn install
    
  • 进入iOS目录清理Pod缓存:
    cd ios
    rm -rf Podfile.lock Pods
    pod cache clean --all
    

3. 重新安装Pods

在iOS目录下执行:

pod install

4. 验证配置

检查Podfile,确保没有手动引入@react-native-firebase相关的pod,Expo的Firebase库会通过config plugin自动配置Pod依赖,无需手动添加。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.15 18:20:38