Expo项目中@react-native-firebase/app与@expo/config-plugins版本兼容问题求助
Expo项目中@react-native-firebase/app与@expo/config-plugins版本冲突解决方案
依赖冲突详情
@react-native-firebase/app@17.4.2 │ └── @expo/config-plugins@5.0.4 ├─┬ @react-native-firebase/auth@17.4.2 │ └── @expo/config-plugins@5.0.4 └─┬ expo@48.0.10 ├─┬ @expo/cli@0.6.2 │ ├── @expo/config-plugins@6.0.1 deduped │ └─┬ @expo/prebuild-config@6.0.0 │ └── @expo/config-plugins@6.0.1 deduped ├── @expo/config-plugins@6.0.1 └─┬ @expo/config@8.0.2 └── @expo/config-plugins@6.0.1 deduped
在Expo 48.0.10项目中使用@react-native-firebase/app@17.4.2及@react-native-firebase/auth@17.4.2时出现兼容性问题,核心原因是RN Firebase包引入了@expo/config-plugins@5.0.4,但项目其余核心依赖(expo、@expo/cli等)均依赖@expo/config-plugins@6.0.1,版本不一致导致冲突,手动安装后问题未解决。
解决步骤
- 强制统一依赖版本
根据你使用的包管理器,在package.json中添加版本强制配置:- 若使用npm,添加
overrides字段:"overrides": { "@expo/config-plugins": "6.0.1" } - 若使用Yarn,添加
resolutions字段:"resolutions": { "@expo/config-plugins": "6.0.1" }
- 若使用npm,添加
- 清理并重新安装依赖
删除node_modules目录和对应的锁文件(package-lock.json或yarn.lock),然后运行:# npm用户 npm install # Yarn用户 yarn install - 验证版本一致性
运行以下命令确认所有依赖都统一使用@expo/config-plugins@6.0.1:# npm用户 npm ls @expo/config-plugins # Yarn用户 yarn list @expo/config-plugins - 版本适配检查
若上述操作后仍有问题,查看@react-native-firebase官方文档,确认v17.4.2是否兼容Expo 48对应的@expo/config-plugins@6.0.1,必要时升级RN Firebase到适配版本。
内容的提问来源于stack exchange,提问作者Shubham Ghanghotia
相关产品推荐
相关产品推荐

