美文网首页
一、 React Native 学习之环境搭建

一、 React Native 学习之环境搭建

作者: 深耕 | 来源:发表于2019-01-12 21:38 被阅读7次

安装依赖

1、必须安装的依赖有:Node、Watchman 和 React Native 命令行工具以及 Xcode。
2、安装Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
3、使用Homebrew来安装 Node 和 Watchman。在命令行中执行下列命令安装:
brew install node
brew install watchman
4、npm 镜像以加速后面的过程
npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global

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

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

Xcode

启动 Xcode,并在Xcode | Preferences | Locations菜单中检查一下是否装有某个版本的Command Line Tools。Xcode 的命令行工具中包含一些必须的工具

创建新项目

react-native init testProject

编译并运行 React Native 应用

cd testProject
react-native run-ios

相关文章

网友评论

      本文标题:一、 React Native 学习之环境搭建

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