NervJS / taro-ui

一款基于 Taro 框架开发的多端 UI 组件库
https://taro-ui.taro.zone
MIT License
4.52k stars 756 forks source link

taro-ui v2.3.4 使用报错 Module not found: Can't resolve 'nervjs' in ....node_modules/taro-ui/dist/h5/components/accordion #1157

Open Laev opened 4 years ago

Laev commented 4 years ago

Taro UI 版本信息

v2.3.4

问题描述

  1. 正常安装taro-cli,默认最新版本:v3.0.5; yarn版本:v 1.22.4
  2. 在执行yarn add taro-ui 后,在页面引入AtButton组件,并渲染,未得到预期出现的按钮,报 Module not found: Can't resolve 'nervjs' in ....node_modules/taro-ui/dist/h5/components/accordion 错误
  3. 再手动安装 nervjs 后出现更多错误

复现步骤

  1. yarn global add @taro-cli
  2. taro init taro-test
  3. 请输入项目介绍: test
  4. 请选择框架: react
  5. 是否需要使用 TypeScript: n
  6. 请选择 CSS 预处理器(Sass/Less/Stylus): sass
  7. 请选择模板:redux
  8. yarn add taro-ui
  9. 在src/pages/index.jsx 中添加“import { AtButton } from 'taro-ui'” 并在render中添加“AtButton”标签
  10. yarn dev:h5

复现代码

复现代码与复现步骤一致,且用taro-cli 3.0.4 版本也根据复现步骤操作了一遍,得到结果一致

报错信息

🙅 Failed to compile.

./node_modules/taro-ui/dist/h5/components/accordion/index.js Module not found: Can't resolve 'nervjs' in '/Desktop/taro-test/node_modules/taro-ui/dist/h5/components/accordion'

系统信息

Taro CLI 3.0.5 environment info: System: OS: macOS 10.15.3 Shell: 5.7.1 - /bin/zsh Binaries: Node: 10.18.0 - ~/.nvm/versions/node/v10.18.0/bin/node Yarn: 1.22.4 - ~/.nvm/versions/node/v10.18.0/bin/yarn npm: 6.13.4 - ~/.nvm/versions/node/v10.18.0/bin/npm npmPackages: @tarojs/components: 3.0.5 => 3.0.5 @tarojs/mini-runner: 3.0.5 => 3.0.5 @tarojs/react: 3.0.5 => 3.0.5 @tarojs/runtime: 3.0.5 => 3.0.5 @tarojs/taro: 3.0.5 => 3.0.5 @tarojs/webpack-runner: 3.0.5 => 3.0.5 babel-preset-taro: 3.0.5 => 3.0.5 eslint-config-taro: 3.0.5 => 3.0.5 react: ^16.10.0 => 16.13.1 taro-ui: ^2.3.4 => 2.3.4

补充信息

taro-ui 3.0.0-alpha.3 版本下是可行的,似乎是taro-ui旧版本与taro-cli脚手架之间的兼容问题

taro-ui-bot[bot] commented 4 years ago

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

git-lt commented 4 years ago

我也有这个问题

Laev commented 4 years ago

我也有这个问题

正常,就是官方的问题,而且这个机器人也不科学,按照它的模板来填写的issue竟然检测还不通过,很迷幻。 你可以通过yarn add taro-ui@3.0.0-alpha.3,看能不能尝试解决

billychen2014 commented 4 years ago

现在taro 和 taro-ui之间的版本兼容有点恼火哦。

git-lt commented 4 years ago

@Laev 按你的方法解决了,谢谢

netdong-li commented 3 years ago

不要写固定的版本号,用这个 yarn add taro-ui@next

ruinb0w commented 1 year ago

不要写固定的版本号,用这个 yarn add taro-ui@next

有用, 官方为什么不在文档里提一嘴, 非得我们google出来