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

@config-plugins/react-native-ble-plx依赖冲突问题求助

解决Expo 48与@config-plugins/react-native-ble-plx依赖冲突问题

我在Expo项目中尝试安装@config-plugins/react-native-ble-plx以使用react-native-ble-plx,执行npx expo install时触发依赖冲突报错,具体错误信息如下:

使用npm进行安装

npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: expo-ble-sample@1.0.0
npm ERR! Found: expo@48.0.5
npm ERR! node_modules/expo
npm ERR! expo@"~48.0.5" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer expo@"^47.0.3" from @config-plugins/react-native-ble-plx@5.0.0
npm ERR! node_modules/@config-plugins/react-native-ble-plx
npm ERR! @config-plugins/react-native-ble-plx@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/macbook/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/macbook/.npm/_logs/2023-03-03T13_38_55_583Z-debug-0.log

报错核心是当前项目使用的expo@48.0.5与@config-plugins/react-native-ble-plx@5.0.0要求的peer依赖expo@^47.0.3版本不兼容,导致依赖树无法解析。

解决方案

1. 安装适配Expo 48的插件版本

@config-plugins/react-native-ble-plx的6.x版本已适配Expo 48,直接安装对应版本即可:

npx expo install @config-plugins/react-native-ble-plx@^6.0.0

2. 临时跳过peer依赖检查

若暂时不想升级插件版本,可使用--legacy-peer-deps参数强制安装:

npx expo install @config-plugins/react-native-ble-plx --legacy-peer-deps

注意:此方法可能引入潜在兼容性问题,仅作为临时方案,后续建议升级到适配版本。

3. 降级Expo到47版本(不推荐)

若必须使用插件5.x版本,可降级Expo至47系列:

npx expo install expo@~47.0.0

注意:该操作会导致项目整体降级,可能影响其他依赖兼容性,非必要不建议采用。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.29 22:33:36