搭建RN的开发环境

1,安装Homebrew

/usr/bin/ruby -e "$(curl -fsSL [https://raw.githubusercontent.com/Homebrew/install/master/install](https://raw.githubusercontent.com/Homebrew/install/master/install))"

需保证能够连接App服务器下载,也可以先安装一个Xcode工具。

xcode-select --install

如果权限不够,需要授予权限:

sudo chown -R `whoami` /usr/local

2,使用Homebrew来安装Node.js:

brew install node

下载最新的npm:https://nodejs.org/zh-cn/download/current/

npm config set registry https://registry.npm.taobao.org --global

npm config set disturl https://npm.taobao.org/dist --global

npm install -g yarn react-native-cli

3,Yarn、React Native的命令行工具(react-native-cli)

yarn config set registry https://registry.npm.taobao.org --global

yarn config set disturl https://npm.taobao.org/dist --global

4,推荐安装的工具

brew install watchman
brew install flow

5,新建并运行项目

react-native init MyApp
cd MyApp
react-native run-ios

你可能感兴趣的:(搭建RN的开发环境)