安装 Cocoapods 错误

Posted

技术标签:

【中文标题】安装 Cocoapods 错误【英文标题】:Installing Cocoapods Error 【发布时间】:2018-08-14 00:29:39 【问题描述】:

当我尝试安装 cocoapods 时,我收到以下错误消息:

ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
    Unable to download data from https://rubygems.org/ - SSL_connect 
returned=1 errno=0 state=SSLv2/v3 read server hello A: tlsv1 alert 
protocol version (https://rubygems.org/latest_specs.4.8.gz)

我以为我已经下载了 cocoapods,但是当我检查版本时使用

pods --version

我明白了:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in to_specs': Could not find 'cocoapods' (>= 0) among 30 total gem(s) (Gem::LoadError) from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:into_spec' 来自 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in gem' from /usr/local/bin/pod:22:in'

关于如何解决它的任何想法?在此先感谢并抱歉格式化。

【问题讨论】:

【参考方案1】:

想通了!只需要更新 Ruby 就可以了。归功于这篇文章:How to update Ruby Version 2.0.0 to the latest version in Mac OSX Yosemite?

【讨论】:

以上是关于安装 Cocoapods 错误的主要内容,如果未能解决你的问题,请参考以下文章

安装 cocoapods 时出现 gem 本机扩展错误

CocoaPods 安装错误:“证书 B:证书验证失败”

CocoaPods 停止安装 Firebase/Analytics 并出现错误

错误:“沙箱与 Podfile.lock 不同步...”在使用 cocoapods 安装 RestKit 后

cocoapods 不能用了 怎么办

使用 CocoaPods 导入错误