Mac上使用react native tips:

1. 安装Homebrew

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

2. 安装nvm 和 node

nvm:

  touch ~/.bash_profile                   -》 环境变量在安装过程中写入

  curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash -》安装后创建~/.nvm

  nvm

node

  nvm install node && nvm alias default node   -》 系统级别的node_modules安装在~/.nvm/versions/node/v5.7.1/lib下面

  node

3. 安装watchman 和 flow

  brew install watchman

  brew install flow

  brew update && brew upgrade

4. 创建Project

  npm install -g react-native-cli     -> 安装react-native 命令到/Users/XXX/.nvm/versions/node/v5.7.1/bin/react-native

下面

  react-native init AwesomeProject   -> 下载npm包, 可以在目录下执行npm start和npm install

5.  试用Project

  会运行一个node server处理请求

  改动index.ios.js,cmd+R可以在线刷新页面

  

install log

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

Dload  Upload   Total   Spent    Left  Speed

100  7766  100  7766    0     0   3012      0  0:00:02  0:00:02 --:--:--  3012

=> nvm is already installed in /Users/XXX/.nvm, trying to update using git

=>

=> Appending source string to /Users/XXX/.bash_profile

=> You currently have modules installed globally with `npm`. These will no

=> longer be linked to the active version of Node when you install a new node

=> with `nvm`; and they may (depending on how you construct your `$PATH`)

=> override the binaries of modules installed with `nvm`:

/Users/XXX/.nvm/versions/node/v5.7.1/lib

└── react-native-cli@0.1.10

=> If you wish to uninstall them at a later point (or re-install them under your

=> `nvm` Nodes), you can remove them from the system Node as follows:

$ nvm use system

$ npm uninstall -g a_module

=> Close and reopen your terminal to start using nvm

node Server log

~/react-native-demos/AwesomeProject/node_modules/react-native/packager ~

┌────────────────────────────────────────────────────────────────────────────┐

│  Running packager on port 8081.                                            │

│                                                                            │

│  Keep this packager running while developing on any JS projects. Feel      │

│  free to close this tab and run your own packager instance if you          │

│  prefer.                                                                   │

│                                                                            │

│  https://github.com/facebook/react-native                                  │

│                                                                            │

└────────────────────────────────────────────────────────────────────────────┘

Looking for JS files in

/Users/XXX/react-native-demos/AwesomeProject

[20:11:09] <START> Building Dependency Graph

[20:11:09] <START> Crawling File System

[Hot Module Replacement] Server listening on /hot

React packager ready.

[20:11:12] <END>   Crawling File System (2400ms)

[20:11:12] <START> Building in-memory fs for JavaScript

[20:11:12] <END>   Building in-memory fs for JavaScript (177ms)

[20:11:12] <START> Building in-memory fs for Assets

[20:11:12] <END>   Building in-memory fs for Assets (138ms)

[20:11:12] <START> Building Haste Map

[20:11:12] <START> Building (deprecated) Asset Map

[20:11:12] <END>   Building (deprecated) Asset Map (36ms)

[20:11:12] <END>   Building Haste Map (366ms)

[20:11:12] <END>   Building Dependency Graph (3087ms)

[20:11:15] <START> request:/index.ios.bundle?platform=ios&dev=true

[20:11:15] <START> find dependencies

[20:11:16] <END>   find dependencies (1416ms)

[20:11:16] <START> transform

transforming [========================================] 100% 505/505

[20:11:26] <END>   transform (9736ms)

[20:11:26] <END>   request:/index.ios.bundle?platform=ios&dev=true (11254ms)

react-native init AwesomeProject

This will walk you through creating a new React Native project in /Users/XXX/react-native-demos/AwesomeProject

Installing react-native package from npm...

Setting up new React Native app in /Users/XXX/react-native-demos/AwesomeProject

To run your app on iOS:

cd /Users/liujunmei/react-native-demos/AwesomeProject

react-native run-ios

- or -

Open /Users/liujunmei/react-native-demos/AwesomeProject/ios/AwesomeProject.xcodeproj in Xcode

Hit the Run button

1、安装nvm
https://github.com/creationix/nvm/

【操作系统版本】
ubuntu 14.04 LTS

【前置依赖】
apt-get install build-essential libssl-dev

【下载安装】

备用法:git clone https://github.com/chenxizhang/nvm.git && ./nvm/install.sh && . ~/.nvm/nvm.sh  && rm –rf ./nvm
curl https://raw.githubusercontent.com/creationix/nvm/v0.23.3/install.sh | bash

root@i-5ygfjuik:~/iojs-v1.1.0-linux-x64# curl https://raw.githubusercontent.com/creationix/nvm/v0.23.3/install.sh | bash
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 5226 100 5226 0 0 4019 0 0:00:01 0:00:01 --:--:-- 4016
=> Downloading nvm from git to '/root/.nvm'
=> Cloning into '/root/.nvm'...
remote: Counting objects: 3328, done.
remote: Total 3328 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3328/3328), 635.28 KiB | 303.00 KiB/s, done.
Resolving deltas: 100% (1894/1894), done.
Checking connectivity... done.

=> Appending source string to /root/.bashrc
=> Close and reopen your terminal to start using nvm

【注意:重新登录系统后才可以使用nvm

=================================================================

2、使用nvm来安装iojs
nvm install iojs

root@i-5ygfjuik:~# nvm install iojs
######################################################################## 100.0%
WARNING: checksums are currently disabled for io.js
Now using io.js v1.1.0

nvm ls 列出所有的版本

然后就用iojs就可以运行了

nvm use system
root@i-5ygfjuik:~# nvm use system
Now using system version of node: v0.11.14.
root@i-5ygfjuik:~#

这回切会11.14

root@i-5ygfjuik:~# nvm ls
    iojs-v1.1.0
-> system

root@i-5ygfjuik:~# nvm use iojs
Now using io.js v1.1.0
root@i-5ygfjuik:~#

然后再切一下就回去咯~~~~爽歪歪

=================================================================

react native mac install的更多相关文章

  1. React Native MAC上环境搭建笔记

    今天花了一点时间搭建了一下react native环境,在这个过程中遇到了一些问题,处理并总结一下,年纪大了记性不好,只能多写写...真是岁月不饶人啊! 第一步:安装最新版本的Xcode工具 第二步: ...

  2. React Native Mac配置指南

    步骤 http://facebook.github.io/react-native/docs/getting-started.html#content 依照React Native官网步骤一步步安装, ...

  3. React Native pod install报错 `Yoga (= 0.44.3.React)` required by `React/Core (0.44.3)`

    使用pod安装,可能会因为Podfile的路径指向错误或者没有路径指向因为报错. 报错截图如下: 这是因为在指定的路径没有寻找到相应的组件.此时就需要修改podfile文件中的路径,由于上方提示没有  ...

  4. react native 环境配置

    1. 安装Homebrew Homebrew主要用于安装后面需要安装的watchman.flow 打开MAC的终端,输入如下命令: ruby -e "$(curl -fsSL https:/ ...

  5. React Native 之 搭建开发环境

    现在只能在MAC系统上安装. 1. 首先,HomeBrew 这是一个包管理库,用来下载其它工具. 打开网站:brew.sh 网页有个命令 /usr/bin/ruby -e "$(curl - ...

  6. 配置React Native的开发环境

    本文转载自:http://mp.weixin.qq.com/s?__biz=MzIxNjEzNjUzOQ==&mid=402020148&idx=2&sn=ccad14a919 ...

  7. 【React Native开发】React Native For Android环境配置以及第一个实例(1)

    年9月15日也公布了ReactNative for Android,尽管Android版本号的项目公布比較迟,可是也没有阻挡了广大开发人员的热情.能够这样讲在2015年移动平台市场上有两个方向技术研究 ...

  8. Mac系统下React Native环境搭建

    这里记录一下在Mac系统下搭建React Native开发环境的过程: 1. 安装HomeBrew: /usr/bin/ruby -e "$(curl -fsSL https://raw.g ...

  9. Mac电脑配置IOS React Native开发环境配置笔记

    React Native(以下简称RN)的开发环境配置直接参考官方文档即可完成,不过对小白来说东西有点多,有些名词不是很好理解,这里就官方的安装文档稍微展开说一下. 中文版配置说明:不错的中文说明.官 ...

随机推荐

  1. source insight 使用技巧

    一.在所有文件中查找字符串 1.菜单栏选择“search project” 2.在随便一个工程文件中把所要查找的字符串输入到空白的地方,然后点连接

  2. css:中文词不断开,整体换行

    一.问题   关于文字的换行与不换行的问题有些特殊情况,是使用css的word-break等属性实现不了的,下面的情况就证明了: 我们想要的效果是,一个词整体换行或不换行,“兼职测试”可以都换至第二行 ...

  3. pragma指令简介

    整理日:2015年3月12日 资源来来自己网络 在编写程序的时候,我们经常要用到#pragma指令来设定编译器的状态或者是指示编译器完成一些特定的动作. 下面介绍了一下该指令的一些常用参数,希望对大家 ...

  4. 《Braid》碎片式台词

    谁见到过风? 你没有,我也没有. 但当树儿低下头, 便是风儿经过时. 便是风儿穿过的时候. 但当树叶微微摇首, 你没有,我也没有. 谁见到过风? 二.时间与宽恕 1.提姆要出发了!他要去寻找并救出公主 ...

  5. Life Forms

    poj3294:http://poj.org/problem?id=3294 题意:就是求n个串的中一个最大的子串,这个子串在超过n/2的串中出现. 题解:这是一道好题.首先一种解法就是用后缀数组来搞 ...

  6. Ubuntu小技巧——怎样安装谷歌Chrome浏览器

    对于刚刚开始使用Ubuntu并想安装谷歌Chrome浏览器的新用户来说,本文所介绍的方法是最快捷的.在Ubuntu上安装谷歌Chrome的方法有很多.一些用户喜欢直接在谷歌Chrome下载页面获得 d ...

  7. Storm on Yarn 安装配置

    1.背景知识 在不修改Storm任何源代码的情况下,让Storm运行在YARN上,最简单的实现方法是将Storm的各个服务组件(包括Nimbus和Supervisor),作为单独的任务运行在YARN上 ...

  8. zoj 3088 Easter Holidays(最长路+最短路+打印路径)

    Scandinavians often make vacation during the Easter holidays in the largest ski resort Are. Are prov ...

  9. bzoj1041

    基于圆的对称性,我们只需要考虑第一象限的整点即可满足条件的x,y都是整数数学上这类问题我们通常用一个量表示另一个量y^2=(r-x)(r+x)  (r-x)(r+x)要是完全平方数令d=gcd(r-x ...

  10. Say To ME

    每天都要有计划,无计划不生活. 计划包括天计划和月计划. 每个月应该有月主题. 避免大概,可能,貌似,等不肯定的词语.增强自信心,增强给别人的自信心. 不熬夜,早睡. 多运动,每周应该至少出门一次,运 ...