首页前端开发文章详情

./node_modules/_taro-ui@1.5.1@taro-ui/dist/h5/components/pagination/index.js

By liajitu / Dec 12, 2018 阅读 0 评论 0 发表于 前端开发 字数:889 阅读时间:9秒

taro-ui

摘要:今天在安装使用taro-ui的时候,npm run dev:h5 编译报错,npm run dev:weapp就不会报错,经过一番折腾,终于解决问题!

环境:

macOS 10.14 (18A391)
node v10.5.0
npm 6.4.1
yarn 0.24.5
taro 1.2.0-beta.14
taro-ui 1.5.1


执行命令:

npm run dev:h5


报错信息:

./node_modules/_taro-ui@1.5.1@taro-ui/dist/h5/components/pagination/index.js 101:11
Module parse failed: Unexpected token (101:11)
You may need an appropriate loader to handle this file type.
|     };
| 
>     return <View className={classNames(rootClassName, classObject, this.props.className)} style={customStyle}>
|         <View className="at-pagination__operate">
|           <View className="at-pagination__btns">

注意:奇怪的是,运行 npm run dev:weapp 就不会报错

经过网上搜索和自己不段的尝试,最终发现原来是 taro-ui@1.5.1 的版本问题,只要把版本降低到 taro-ui@1.5.0就可以解决问题,操作命令如下:

cnpm install taro-ui@1.5.0

安装完成后,执行

npm run dev:h5

看到Compiled successfully! 心里那个高兴啊!

开始编译项目 gaoxiao
创建  发现文件  src/app.less
创建  发现文件  src/app.tsx
创建  发现文件  src/index.html
创建  发现文件  src/pages/index/index.less
创建  发现文件  src/pages/index/index.tsx

✅  Compiled successfully!

End!

手机扫码阅读,舒服~

⌘ + Return 发表
最新 最早 全部评论0 条评论