[有步骤,无细节]React Native入门

中文文档
官网

[有步骤,无细节]React Native入门_第1张图片
Paste_Image.png

安装Xcode及Command Line Tools

  • Xcode建议App Store下载
  • Command Line Tools从https://developer.apple.com/download/more/ 下载与Xcode对应版本

安装Homebrew及wget

  • 打开终端
  • 安装Homebrew。复制粘贴下面脚本,回车
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • 安装wget。等待上面执行完成,复制粘贴下面脚本,回车
brew install wget

安装NVM(Node Version Manager的缩写)

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash

若是出现下面问题,请先touch ~/.bash_profile,再次输入安装命令.检测是否成功,输入command -v nvm,输出nvm

[有步骤,无细节]React Native入门_第2张图片
install_nvm_error.png

通过NVM,安装最新版Nood.js

nvm install node && nvm alias default node

安装watchman(需要科学上网)

brew install watchman
[有步骤,无细节]React Native入门_第3张图片
install_watchman_error.png

科学上网吧~

安装flow(需要科学上网)

brew install flow
[有步骤,无细节]React Native入门_第4张图片
install_flow_error.png

科学上网吧~


使用淘宝镜像

  • 配置淘宝镜像
npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global
  • 变更/usr/local的所属用户组或者用户
sudo chown -R $(whoami) /usr/local
  • 安装nrm(NPM registry 管理工具)
npm i -g nrm
  • 查看所有源
nrm ls
  • 切换到淘宝镜像
nrm use taobao
  • 切换回官方源
nrm use npm
  • 清缓存
npm cache clean

安装react-native-cli(用来开发React Native的命令行工具)

npm install -g react-native-cli

创建React Native工程

react-native init YourProjectName

你可能感兴趣的:([有步骤,无细节]React Native入门)