mac下配置React native开发环境

一、需要的东西:

  1. Note.js
  2. React Native Command Line Tools
  3. XCode/AndroidStudio

二、安装软件包管理器:Homebrew

安装命令:

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

查看版本:

brew --version

三、安装最新版git

安装命令:

brew install git

查看版本:

git --version

四、安装 Node

安装命令:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
//安装指定版本:
nvm install vx.x.x 如v6.11.0 

查看版本:

nvm ls-remote

五、npm 的简介与升级

# 安装 react 模块
npm install react 

# 全局安装 react-native-cli 模块 
npm install -g react-native-cli

# 升级
npm install -g npm

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

npm install -g react-native-cli

七、安装Facebook 提供的监视文件变化的工具:Watchman

brew install watchman

八、安装静态的JS类型检查工具:flow

brew install flow

九、 创建项目

react-native init HelloWorld
cd cd /Users/youMacName/FirstApp
react-native run-ios

十、注意事项

React-Native服务在编写过程中要一直开着,如果不小心把它关了,没关系,可以在终端输入:

npm start

来重新开启服务。

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

推荐阅读更多精彩内容