react16构建报错 Unable to resolve module react-native-pager-view from xx react-native-pager-view could
·
java8 python2.7 node12.40 react16老项目
在andorid studio中构建 Generate Signed App Bundle or APK 报错:
Unable to resolve module react-native-pager-view from D:\xiaozhikanfang\xiaoming\code61\xiaozhikanfang\node_modules\@ant-design\react-native\lib\carousel\index.js: react-native-pager-view could not be found within the project.
根绝ai解析的问题该bug有两方面的来源:
1. 依赖版本冲突(核心问题)
你的项目中:
-
@ant-design/react-native:^4.0.0- 这是较新版本 -
react-native:^0.62.2- 这是老版本
问题:@ant-design/react-native@4.0.0+ 版本内部依赖 react-native-pager-view,但这个依赖在你的 package.json 中没有显式声明,也没有安装。
2. 为什么会出现这个错误?
查看 @ant-design/react-native 的版本发布说明:
-
v4.x.x版本:使用react-native-pager-view作为 carousel 组件的底层实现 -
v3.x.x版本:使用@react-native-community/viewpager或其他实现
你的项目中有 @react-native-community/viewpager: ^4.0.1,这说明原本可能是兼容旧版本的,但 @ant-design/react-native@4.0.0 已经迁移到了新的 pager-view。
尝试解决:
1. 单独安装 react-native-pager-view 构建时,又出现了其他antd插件冲突问题
2.清除安装缓存和node_modules 无效
最后是将老前辈的node_modules强行复制过来,清除Android studio缓存生效了。
更多推荐
所有评论(0)