美文网首页
01、Mac 上配置RN的开发环境

01、Mac 上配置RN的开发环境

作者: 社会你狗哥 | 来源:发表于2017-10-11 14:02 被阅读0次

1、打开本地权限

sudo chown -R `whoami` /usr/local

2、安装honebrew

curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local —strip1

3、检测brew是否安装成功

brew

4、更新brew

brew update

5、如果4失败,再次执行步骤1,

Brew update

会出现如下:

Receiving objects: 100% (1130/1130), 1.21 MiB | 228.00 KiB/s, done.

Resolving deltas: 100% (117/117), done.

From https://github.com/Homebrew/brew

* [new branch]master-> origin/master

HEAD is now at 56458f0 Merge pull request #3277 from sjackman/audit-notable

To restore the stashed changes to /usr/local run:

'cd /usr/local && git stash pop'

==> Downloading https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz

curl: (7) Failed to connect to akamai.bintray.com port 443: Operation timed out

Error: Download failed: https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz

Error: Failed to install vendor Ruby.

6、安装folw, watchman

brew install flow

brew install watchman

7、Node.js直接下载双击安装

8、设置npm镜像加速后续进程

npmconfig set registry https://registry.npm.taobao.org --global

npmconfig set disturl https://npm.taobao.org/dist —global

9、安装Yarn、React Native的命令行工具(react-native-cli)

npminstall -g yarn react-native-cli

设置镜像源:

yarn configsetregistry https://registry.npm.taobao.org--global

yarn configsetdisturl https://npm.taobao.org/dist—global

安装完yarn之后就可以用yarn代替npm了,例如用yarn代替npm install命令,用yarn add某第三方库名代替npm install --save某第三方库名。

10、测试安装

10.1创建工程

react-nativeinit AwesomeProject

10.2导出成功包

cd AwesomeProject

react-nativerun-ios

11、xcode上运行工程时,要先打开服务器权限

npm start

12、在index.ios.js中修改代码

相关文章

网友评论

      本文标题:01、Mac 上配置RN的开发环境

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