ReactNative 环境配置

一直是从事iOS的开发,现在研究下mac环境下reatNative的环境配置:

1. 安装HomeBlew(OS系统上的一个安装包管理器,安装后可以方便后续安装包的安装。)

终端命令:

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


2. 安装Node.js (服务端的JavaScript运行环境)

下载地址:https://nodejs.org/download/

成功安装后,终端会有如下提示信息:

Node.js was installed at: /usr/local/bin/node

npm was installed at: /usr/local/bin/npm

Make sure that /usr/local/bin is in your $PATH.


3. 建议安装WatchMan(React修改source文件的一个工具)

终端命令: 

brew install watchman

4. 安装Flow: 一个JavaScript 的静态类型检查器。

终端命令:

brew install flow

5. 安装React Native CLI: 用来开发React Native的命令行工具

终端命令:

npm install -g react-native


创建项目1. 新建一个项目

  新建一个“HelloWorld”的项目,每个语言的开始教程都是这个,我们也不例外。

操作超级简单,只需终端输入命令行:

react-native init HelloWorld 

这样就新建了一个工程,前往文件夹:/用户/xxx/HelloWorld (xxx为电脑用户名),打开iOS文件下的工程:

注意:打开后会报以下错误

❌ error: Build input file cannot be found:'/Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/strtod.cc'▸ Compiling fast-dtoa.cc

❌ error: Build input file cannot be found:'/Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/fast-dtoa.cc'▸ Compiling fixed-dtoa.cc

❌ error: Build input file cannot be found:'/Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/fixed-dtoa.cc'▸ Compilingdouble-conversion.cc

❌ error: Build input file cannot be found:'/Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/double-conversion.cc'▸ Compiling diy-fp.cc

❌ error: Build input file cannot be found:'/Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/diy-fp.cc'▸ Compiling cached-powers.cc

❌ error: Build input file cannot be found:'/Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/cached-powers.cc'▸ Compiling bignum.cc

❌ error: Build input file cannot be found:'/Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/bignum.cc'

解决方案

cd node_modules/react-native/scripts && ./ios-install-third-party.sh &&cd../../../

cd node_modules/react-native/third-party/glog-0.3.5/ && ../../scripts/ios-configure-glog.sh

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 在对的时间 对的地点 公主遇上王子 在属于他们的千年古堡里 上演天使般的童话 这童话的主角 就是 现在的我 未来的...
    噌經如今怎能相吡阅读 450评论 0 1
  • 6-6 没有心流,还是时不时的会迷茫人生,因为还没有一坚定的信念引导我。 肌肉可以锻炼出来,学习可以锻炼出来,但不...
    孙二丹阅读 292评论 0 1
  • 一、 90后00后现在越来越多年轻人乐此不疲过着日夜颠倒的生活,熬夜便成了家常便饭。 用70后80后的话来讲就是白...
    北不及北阅读 514评论 0 3
  • 你从哪里来? 是苍茫无尽的原野? 还是崎岖的山地? 破壳出芽, 你一粒赶着一粒, 娇嫩包着坚强呱呱落地。 成长抽穗...
    chenxs09阅读 372评论 0 1
  • 文/马克苏 理想,大概是每个人都想过并且追寻的东西吧。它就像你的影子,你向前它也会跟你向前,你停下脚步,它也便停滞...
    赵不渝阅读 567评论 2 2