自学react-native,搭建ios环境踩了不少坑,仅供参考。。。
1.安装brew
/bin/zsh -c “$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)”
2.安装node
brew install node
npx nrm use taobao (可选切换淘宝源,快)
3.安装yarn (高级版npm)
npm install -g yarn
4.安装cocoapods (ios依赖库)
brew install cocoapods
切换源
pod repo remove trunk
pod repo add master https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git
5.安装watchman(官网文档说要装,但是我装了就会报错,卸载了就可以跑了,迷~)
·brew install watchman
6.安装xCode
appstore有
7.安装react-native-cli 脚手架
npm install -g react-native-cli
8.创建helloworld工程
react-native init helloworld
9.启动
cd helloworld;npm run ios