react Native 从零开始 mac配置环境

react Native从零开始 mac配置环境

在mac下,我们需要安装的依赖有:Node、Watchman 和 React Native 命令行工具以及 Xcode。
这里我们用 Homebrew来安装node和Watchman.
安装命令为

brew install node
brew install watchman

然后我们来安装淘宝镜像

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

注意:不要使用 cnpm!cnpm 安装的模块路径比较奇怪,packager 不能正常识别!

之后我们来安装yarn 和 react native 并配置yarn的淘宝镜像

npm install -g yarn react-native-cli

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 的命令行工具中包含一些必须的工具,比如git等。

在这里插入图片描述
之后我们就可以创建项目了

猜你喜欢

转载自blog.csdn.net/severzhao27/article/details/95060757