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

使用EAS构建React Native iOS应用遇Firebase/CoreOnly Pod版本兼容问题

解决EAS构建React Native iOS应用时Firebase/CoreOnly版本冲突问题

问题概述

使用EAS构建React Native iOS应用时,卡在CocoaPods版本兼容错误:[!] CocoaPods could not find compatible versions for pod "Firebase/CoreOnly"。已尝试删除Podfile重新下载、调整package.json版本,但问题仍未解决。

错误根源分析

从构建日志可明确冲突点:

  • expo-firebase-core(版本6.0.0,对应Expo 48)依赖Firebase/Core 9.5.0,进而要求Firebase/CoreOnly = 9.5.0
  • @react-native-firebase/app(版本16.5.0)要求Firebase/CoreOnly = 10.3.0
    两者对同一Pod的版本要求完全冲突,导致CocoaPods无法解析依赖。

解决方案

需让两个库依赖的Firebase/CoreOnly版本一致,以下两种方案二选一:

方案一:降级@react-native-firebase/app到匹配Expo 48的版本

Expo 48的expo-firebase-core 6.0.0仅支持Firebase 9.x系列,因此将@react-native-firebase/app降级到依赖Firebase 9.x的版本(如15.7.0):

  1. 修改package.json中的依赖:
    "@react-native-firebase/app": "^15.7.0"
    
  2. 保留firebase npm包版本为^9.15.0(与Firebase 9.x兼容)
  3. 执行npm install或yarn install更新依赖
  4. 在EAS构建页面选择「清除缓存并重试构建」,或本地运行:
    eas build --platform ios --clear-cache
    

方案二:升级Expo及相关Firebase库到支持Firebase 10.x的版本

Expo 49及以上版本的expo-firebase-core支持Firebase 10.x,可升级整个Expo生态:

  1. 修改package.json中的核心依赖:
    "expo": "^49.0.0",
    "expo-firebase-recaptcha": "~2.6.0",
    "@react-native-firebase/app": "^16.5.0"
    
  2. 确保react-native版本升级到与Expo 49兼容的0.72.x版本(需同步调整相关依赖如react-native-reanimated、react-native-screens等)
  3. 执行npm install或yarn install更新依赖
  4. 清除缓存后重新构建

调整后的package.json依赖示例(方案一)

"dependencies": {
  "@react-native-camera-roll/camera-roll": "^5.2.1",
  "@react-native-community/checkbox": "^0.5.14",
  "@react-native-community/netinfo": "9.3.7",
  "@react-native-firebase/app": "^15.7.0",
  "@react-navigation/native": "^6.1.1",
  "@react-navigation/native-stack": "^6.9.7",
  "@stream-io/flat-list-mvcp": "^0.10.2",
  "expo": "^48.0.0",
  "expo-firebase-recaptcha": "~2.3.1",
  "expo-modules-autolinking": "~1.1.0",
  "expo-splash-screen": "~0.18.1",
  "expo-status-bar": "~1.4.4",
  "firebase": "^9.15.0",
  "react": "^18.2.0",
  "react-native": "0.71.3",
  "react-native-document-picker": "^8.1.3",
  "react-native-elements": "^3.4.3",
  "react-native-fs": "^2.20.0",
  "react-native-gesture-handler": "~2.9.0",
  "react-native-gifted-chat": "^1.1.0",
  "react-native-image-crop-picker": "^0.39.0",
  "react-native-image-resizer": "^1.4.5",
  "react-native-keyboard-aware-scroll-view": "^0.9.5",
  "react-native-phone-number-input": "^2.1.0",
  "react-native-reanimated": "~2.14.4",
  "react-native-screens": "~3.20.0",
  "react-native-select-dropdown": "^3.2.1",
  "react-native-svg": "13.4.0",
  "react-native-webview": "11.26.0",
  "react-navigation": "^4.4.4",
  "react-phone-input-2": "^2.15.1",
  "react-phone-number-input": "^3.2.15",
  "react-router-dom": "^6.6.2",
  "reshake": "^1.2.4",
  "rn-swipe-button": "^1.3.8",
  "source-map-resolve": "^0.6.0",
  "stream-chat": "^8.2.1",
  "stream-chat-expo": "^5.7.0",
  "stream-chat-react-native": "^5.7.0",
  "styled-components": "^5.3.6",
  "unique-names-generator": "^4.7.1",
  "urix": "^0.1.0"
}

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.27 21:52:56