1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
## 安装 nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash

## 安装 node
nvm install node && nvm alias default node

## 安装 watchman
brew install watchman

## 安装 flow
brew install flow

## 更新
brew update && brew upgrade

## 快速开始
npm install -g react-native-cli
react-native init AwesomeProject

To run the iOS app:

  • $ cd AwesomeProject
  • Open ios/AwesomeProject.xcodeproj and hit run in Xcode.
  • Open index.ios.js in your text editor of choice and edit some lines.
  • Hit ⌘-R in your iOS simulator to reload the app and see your change!

To run the Android app:

  • $ cd AwesomeProject
  • $ react-native run-android
  • Open index.android.js in your text editor of choice and edit some lines.
  • Press the menu button (F2 by default, or ⌘-M in Genymotion) and select Reload JS to see your change!
  • Run adb logcat *:S ReactNative:V ReactNativeJS:V in a terminal to see your app’s logs

安装和使用node某版本

1
2
nvm install 5.0
nvm use 5.0

Tips

建议先卸载本机上原有的node,然后用nvm安装,以免混乱。