Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用taro init新建taro-ui模板的项目时有依赖问题 #15642

Closed
liyafe1997 opened this issue May 5, 2024 · 1 comment
Closed

使用taro init新建taro-ui模板的项目时有依赖问题 #15642

liyafe1997 opened this issue May 5, 2024 · 1 comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 to be closed V-3 Version - 3.x

Comments

@liyafe1997
Copy link

相关平台

微信小程序

小程序基础库: 无关
使用框架: React

复现步骤

? 请选择框架 React
? 是否需要使用 TypeScript ? Yes
? 请选择 CSS 预处理器(Sass/Less/Stylus) Sass
? 请选择编译工具 Webpack5
? 请选择包管理工具 npm
? 请选择模板源 Gitee(最快)
✔ 拉取远程模板仓库成功!
? 请选择模板 taro-ui(使用 taro-ui 的模板)

npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"^18.0.0" from the root project
npm ERR! peer react@">=16.13.0" from [email protected]
npm ERR! node_modules/taro-ui
npm ERR! taro-ui@"^3.2.1" from the root project
npm ERR! 1 more (react-dom)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"18.2.0" from [email protected]
npm ERR! node_modules/react-native
npm ERR! peer react-native@">=0.62.0" from [email protected]
npm ERR! node_modules/taro-ui
npm ERR! taro-ui@"^3.2.1" from the root project

期望结果

能新建项目

实际结果

依赖错误

环境信息


👽 Taro v3.6.28


  Taro CLI 3.6.28 environment info:
    System:
      OS: Linux 6.8 Ubuntu 24.04 LTS 24.04 LTS (Noble Numbat)
      Shell: 5.2.21 - /bin/bash
    Binaries:
      Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
      npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.28 => 3.6.28
      @tarojs/helper: 3.6.28 => 3.6.28
      @tarojs/plugin-framework-react: 3.6.28 => 3.6.28
      @tarojs/plugin-platform-alipay: 3.6.28 => 3.6.28
      @tarojs/plugin-platform-h5: 3.6.28 => 3.6.28
      @tarojs/plugin-platform-jd: 3.6.28 => 3.6.28
      @tarojs/plugin-platform-qq: 3.6.28 => 3.6.28
      @tarojs/plugin-platform-swan: 3.6.28 => 3.6.28
      @tarojs/plugin-platform-tt: 3.6.28 => 3.6.28
      @tarojs/plugin-platform-weapp: 3.6.28 => 3.6.28
      @tarojs/react: 3.6.28 => 3.6.28
      @tarojs/runtime: 3.6.28 => 3.6.28
      @tarojs/shared: 3.6.28 => 3.6.28
      @tarojs/taro: 3.6.28 => 3.6.28
      @tarojs/taro-loader: 3.6.28 => 3.6.28
      @tarojs/webpack5-runner: 3.6.28 => 3.6.28
      babel-preset-taro: 3.6.28 => 3.6.28
      eslint-config-taro: 3.6.28 => 3.6.28
      react: ^18.0.0 => 18.3.1

@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels May 5, 2024
@koppthe
Copy link
Contributor

koppthe commented May 7, 2024

因为 taro-ui 的 peerDependencies 包含 react-native,有两个解决方案:

  1. 手动安装 react-native 依赖;
  2. 如果没有 RN 的需求,可以使用 npm install -legacy-peer-deps 忽略冲突;

@koppthe koppthe closed this as completed May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 to be closed V-3 Version - 3.x
Projects
Archived in project
Development

No branches or pull requests

2 participants