react-native:环境安装

前端之家收集整理的这篇文章主要介绍了react-native:环境安装前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

环境要求:OS X ,要开发ios App就必须使用Mac OS系统。
Homebrew:安装教程http://brew.sh/,Mac上的包管理软件
Node.js :https://nodejs.org/en/
watchman:https://facebook.github.io/watchman/docs/install.htmlfacebook的一个文件监视系统。
flow:http://flowtype.org/js的变量检查

安装@H_502_7@

安装Homebrew:

@H_301_10@

/usr/bin/ruby -e "$(curl -fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install)"

安装node.js

brew install node

安装watchman

brew install watchman

安装flow

brew install flow

更新当前软件到最新版本@H_502_7@

更新Homebrew版本库

brew update

更新软件

brew upgrade

安装react-native@H_502_7@

npm install -g react-native-cli

─┬ react-native-cli@0.1.10
  ├─┬ chalk@1.1.1
  │ ├─┬ ansi-styles@2.2.0
  │ │ └── color-convert0.0
  │ ├── escape-string-regexp5
  │ └── strip-ansi@3.1
  ├─┬ prompt2.14
  │ ├─┬ read7
  │ │ └── mute-stream6
  │ └─┬ utile2.1
  │   ├── i3.4
  │   └─┬ rimraf5.2
  │     └─┬ glob@7.0
  │       ├─┬ minimatch0
  │       │ └─┬ brace-expansion1.3
  │       │   └── balanced-match3.0
  │       └── once3.3
  └── semver@5.1.0

react-native安装成功

第一个react-native项目@H_502_7@

react-native init HelloRN

o run your app on iOS:
   cd /Users/***/Documents/github/react-native/HelloRN
   react-native run-ios
   - or -
   Open /Users/***/Documents/github/react-native/HelloRN/ios/HelloRN.xcodeproj in Xcode
   Hit the Run button
To run your app on Android:
   Have an Android emulator running (quickest way to get started),or a device connected
   cd /Users/***/Documents/github/react-native/HelloRN
   react-native run-android

运行@H_502_7@

react-native run-ios

在当前目录下面多了一个ios的目录,里面新建一个project,HelloRN的项目。

react-native run-android

在当前目录下会多出一个anroid的目录,里面是android项目的文件

原文链接:https://www.f2er.com/react/306622.html

猜你在找的React相关文章