-
Notifications
You must be signed in to change notification settings - Fork 750
Open
Description
问题描述
在 Taro 4.1.1 + React 18 环境下安装 taro-ui@3.3.0 时,出现严重的版本依赖冲突。taro-ui 3.x 强制要求 React 19 类型定义,但 Taro 4.1.1 核心库依赖 React 18,导致项目无法正常构建。
复现步骤
- 使用 Taro CLI 初始化项目:
taro init NongHi --framework react --typescript
- 安装基础依赖:
npm install
- 尝试安装 taro-ui:
npm install taro-ui@3.3.0
- 出现依赖解析错误(完整错误见下文)
期望行为
taro-ui 3.x 应该提供兼容 React 18 的版本,或 Taro 官方文档应明确标注版本兼容矩阵。
报错信息
npm error ERESOLVE unable to resolve dependency tree
npm error While resolving: NongHi@1.0.0
npm error Found: @types/react@18.3.21
npm error Could not resolve dependency:
npm error peerOptional @types/react@"^19.0.0" from react-native@0.79.2
npm error Conflict caused by:
npm error taro-ui@3.3.0 → react-native@0.79.2 → @types/react@^19.0.0
npm error Fix with:
npm error npm install --legacy-peer-deps
系统信息
- Taro 版本:v4.1.1
- Taro UI 版本:v3.3.0
- Node.js 版本:v18.20.2
- 平台:weapp
- 包管理工具:npm 8.19.4
补充信息
- 根本原因分析:
- taro-ui 3.x 的 react-native 依赖未做好向后兼容
- Taro 官方未在文档中明确版本要求
Metadata
Metadata
Assignees
Labels
No labels