Cocoapods安装错误解决方案

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sinat_28585351/article/details/77969632

错误提示为: 
Setting up CocoaPods master repo 
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master

Cloning into ‘master’… 
error: RPC failed; result=56, HTTP code = 200 
fatal: The remote end hung up unexpectedly 
fatal: early EOF 
fatal: index-pack failed

解决方案: 
首先通过终端cd到~/.cocoapods/repos下,在此目录下,输入终端命令: 

sudo -rm -rf ~/.cocoapods/


git clone ‘https://github.com/CocoaPods/Specs.git’ master

剩下的就是漫长的等待,文件比较大,可能花费些时间,结果如下所示:

Cloning into ‘master’… 
remote: Counting objects: 760233, done. 
remote: Compressing objects: 100% (34/34), done. 
remote: Total 760233 (delta 12), reused 0 (delta 0), pack-reused 760197 
Receiving objects: 100% (760233/760233), 350.74 MiB | 44.00 KiB/s, done. 
Resolving deltas: 100% (324910/324910), done. 
Checking connectivity… done. 
Checking out files: 100% (98969/98969), done. 
完成后就可继续安装,即使用:pod setup命令。

删除~/Library/Caches/CocoaPods目录下的search_index.json文件

    • pod setup成功后,依然不能pod search,是因为之前你执行pod search生成了search_index.json,此时需要删掉。
    • 终端输入:rm ~/Library/Caches/CocoaPods/search_index.json
    • 删除成功后,再执行pod search
    • 执行pod search
    • 终端输入:pod search afnetworking(不区分大小写)
    • 输出:Creating search index for spec repo 'master'.. Done!,稍等片刻······就会出现所有带有afnetworking字段的类库。


猜你喜欢

转载自blog.csdn.net/sinat_28585351/article/details/77969632