React native 在mac下安裝 环境

前言

 春节回来上班第一天,配了mac ,然后在去年就有要弄mac 配置RN教程,好勒一上午,其中有遇到一些问题,都解决 了

当然你可以看官网的步骤啦 https://reactnative.cn/docs/getting-started.html,其实都差不多哦

安装过程

Homebrew, Mac系统的包管理器,用于安装NodeJS和一些其他必需的工具软件

打开终端输入:

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

使用Homebrew来安装Node.js,没有梯子的话建议设置npm镜像

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

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

npm install -g react-native-cli

创建项目

react-native init MyApp --version 0.44.3。

 因为0.45版本以上需要FQ,然后有些还会出错 就需要制定版本啦

在打开xcode 运行

cd AwesomeProject
react-native run-ios

 遇到的问题

解决办法  

 是因为你的权限不够,用这个来改变权限

输入命令

 sudo chown -R $USER /usr/local 

随后要求输入用户密码,即你的开机密码

扫描二维码关注公众号,回复: 5160315 查看本文章

猜你喜欢

转载自www.cnblogs.com/yf-html/p/10362108.html
今日推荐