Taro框架0-1

322 阅读1分钟

一、安装及初步使用

(一)、安装

Taro 项目基于 node,请确保已具备较新的 node 环境(>=12.0.0)

(二)、CLI工具安装

可使用 npm 进行全局安装 @tarojs/cli

使用 npm 安装 CLI

$ npm install -g @tarojs/cli

注:

1、出现的错误

errno: -13 解决

是因为没有权限导致,运行 sudo npm install -g @tarojs/cli

(三)、创建taro+react项目

1、执行 taro init project

注:错误信息

(node:11818) UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@tarojs/cli/templates/taro-temp' (Use node --trace-warnings ... to show where the warning was created) (node:11818) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see nodejs.org/api/cli.htm…). (rejection id: 1) (node:11818) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. 解决 是因为没有权限导致,运行 sudo taro init project创建项目