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服務(wù)器下載滨攻,也可以先安裝一個Xcode工具。
xcode-select --install
如果權(quán)限不夠谆构,需要授予權(quán)限:
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魏保,新建并運(yùn)行項目
react-native init MyApp
cd MyApp
react-native run-ios