2020年React-Native 开发环境搭建

按照中文网一步一步往下:
1.先安装这个brew ,打开网址:https://brew.sh里头有安装指令:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

安装完brew,就可以安装node ,watchman,yarn,cocoapods

如果安装brew报错:
Failed to connect to raw.githubusercontent.com port 443: Connection refused

打开此网站(https://githubusercontent.com.ipaddress.com/raw.githubusercontent.com
)查看raw.githubusercontent.com 的ip地址,然后修改 /etc/hosts 文件,新增:

# 你查到的IP地址
199.232.68.133   githubusercontent.com
brew install node
brew install watchman
# 使用nrm工具切换淘宝源
npx nrm use taobao
npm install -g yarn

brew install cocoapods

最后就是:



cd AwesomeProject
yarn ios
# 或者
yarn react-native run-ios

会有一个报错:
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./iosProject/ios && pod install".

这个没事,按照提示:

#先设置xcode路径
sudo xcode-select --switch /Applications/Xcode.app         
cd ./iosProject/ios && pod install

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