搭建环境
内容摘自:
React-Native中文
1. (必须)安装Chocolately
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
期间尽量使用vpn工具
2. 安装Python 2
choco install python2
3. 安装NodeJs
choco install nodejs.install
安装之后使用npm设置代理
npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global
使用Yarn替代NPM来安装远程包,加速工程的开发
安装Yarn npm install -g yarn react-native-cli
安装完之后设置镜像
yarn config set registry https://registry.npm.taobao.org --global
yarn config set disturl https://npm.taobao.org/dist --global
新建项目和运行项目
使用CMD命令CD到你要创建项目的目录下面,使用如下命令:
react-native init AwesomeProject
cd AwesomeProject
react-native run-android
网友评论