youngjuning / issues

一寸欢喜 - 怕什么真理无穷,进一寸有一寸的欢喜
https://youngjuning.js.org
44 stars 4 forks source link

解决React-native init 初始化时 info Installing required CocoaPods dependencies #210

Closed youngjuning closed 4 years ago

youngjuning commented 4 years ago

React Native 0.60 之后 ios 默认使用 CocoaPods,由于墙的存在,导致安装依赖极慢,甚至超时崩溃:

info Installing required CocoaPods dependencies

在网上找了下原因,主要是网络慢或网络连接的原因,解决方案如下:

1、 Ctrl + C 退出命令行

2、 安装 Cocoapods:sudo gem install cocoapods

3、 设置镜像:

$ cd ~/.cocoapods/repos 
$ pod repo remove master
$ git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master

4、进入自己的工程, 在自己工程的podFile第一行加上:

source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'

5、安装

pod install