美文网首页React-Native之跃
React-Native之环境搭建(一)

React-Native之环境搭建(一)

作者: 因幡白兔 | 来源:发表于2017-06-11 20:18 被阅读57次

注:这里只介绍MACOS下iOS的搭建(其它请左转MAC-Android,Windows-Android)

首先打开终端安装Homebrew:(用来下载Node.JS的MAC包管理器)

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

接着通过Homebrew下载Node(装完以后npm也就存在了):

 brew install node

然后我们给npm设置镜像加速(开发过iOS的可以把npm理解为RN里的Cocoapods):

npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global

Yarn是Facebook提供的替代npm的工具,可以加速node模块的下载。现在让我们也进行一波下载:

npm install -g yarn react-native-cli

[Yarn]设置镜像加速

yarn config set registry https://registry.npm.taobao.org --global
yarn config set disturl https://npm.taobao.org/dist --global

权限不够的话:

sudo chown -R `whoami` /usr/local

安装Xcode(需要8.0以上版本)

常用编辑器:

Webstroms(推荐:功能强大,最新版本也支持RN联想,缺点是比较大)
VSCode(推荐:小巧,插件多)
Atom
Sublime 

到此环境就搭建完了,之前搭建出现过node.js版本和npm版本不匹配的问题,直接去node.js官网找包下载对应版本的包。

相关文章

网友评论

    本文标题:React-Native之环境搭建(一)

    本文链接:https://www.haomeiwen.com/subject/fntkqxtx.html