您的位置:首页 > 运维架构

Cocoapods安装错误解决方案

2017-09-13 18:51 281 查看
错误提示为: 

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字段的类库。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息