1.安装Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2.安装nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash
3.安装node.js
nvm install node && nvm alias default node
4.安装watchman
brew install watchman
5.安装flow (貌似可选)
brew install flow
6.切换npm源为淘宝
npm config set registry https://registry.npm.taobao.org
npm config set disturl https://npm.taobao.org/dist
7.初始化组件
npm install -g react-native-cli
8.创建工程 (AwesomeProject 为工程名字)
react-native init AwesomeProject
9.进入当前用户文件夹,找到创建的工程文件夹
npm install
npm start
10.xcode 模拟器开始编译。如果要真机编译,需要修改Appdelegate里面host地址为本机地址,确保真机和电脑在同一个网络下
网友评论