创建:
1.安装taro-cli
//npm
npm install -g @tarojs/cli
//yarn
yarn global add @tarojs/cli
//cnpm
cnpm install -g @tarojs/cli
2.创建项目
taro init <projectname>
3.安装依赖
//npm
npm install
//yarn
yarn
//cnpm
cnpm install
4.安装tao-ui
npm install taro-ui
5.运行项目
//npm
npm run dev:weapp npm run build:weapp
//yarn
yarn dev:weapp yarn build:weapp
//全局安装
taro build --type weapp --watch tarobuild --type weapp
微信小程序:weapp 百度小程序:swan 支付宝小程序:alipay 字节跳动小程序:tt QQ小程序:qq 京东小程序:jd 快应用:quickapp h5:h5 React Native:rn
报错:
一:报版本问题
@tarojs/cli - npm这个网址可以查到最新的taro/cli版本
1.更新taro cli工具至最新
//taro
taro update self [version]
//npm
npm i -g @tarojs/cli@[version]
//yarn
yarn global add @tarojs/cli@[version]
2.更新taro相关的依赖
taro update project [version]
二: 报no such file or directory, open 'E:\lily\taro project\taro-weapp\node_modules\@tarojs\components\dist\@tarojs\taro-h5'
[BABEL] Note: The code generator has deoptimised the styling of "E:/lily/taro project/taro-weapp/node_modules/@tarojs/components/dist/index.js" as it exceeds the max of "500KB".
解决:
import { View, Text, Swiper, SwiperItem, ScrollView } from '@tarojs/components'
import { AtSearchBar, AtGrid, AtTabs, AtTabsPane } from 'taro-ui'
是代码的错误,在组件引入的时候部分是通过@tarojs/components引入的,部分是通过taro-ui引入的,因为没有正确引入报出该错误
三: 安装taro-ui报

解决:安装命令更改为
yarn add taro-ui