首页 > react-native 开发环境的搭建

react-native 开发环境的搭建

react-native 开发环境的搭建

  1. 目前react-native还只支持IOS开发,因此环境必须是在MAC上,准备台苹果吧~,安装Xcode最新版本

  2. 安装brew,
    打开http://brew.sh/按照提示:

    `
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    `

  3. 安装watchman,flow,io.js
    (https://iojs.org/en/index.html)

    `
    nvm install iojs-v2 && nvm alias default iojs-v2
    bres install flow
    brew install watchman

    `

  4. 快速开始
    npm install -g react-native-cli
    react-native init HelloWorld

碰到的问题:

 >1.安装过程中由于很多镜像是国外的,需要开启shadowsocks加快环境搭建的速度
 >2.安装的时候没有安装io.js,好像有问题
 >3.安装好了以后打开文件总是有问题,打不开页面,仔细看了下,我本地没有配置localhost,打开AppDelegate.m修改:
 

 jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"];
 
改为
jsCodeLocation = [NSURL URLWithString:@"http://127.0.0.1:8081/index.ios.bundle"];
【热门文章】
【热门文章】