最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[已解决]gem install cocoapods出错:ERROR Could not find a valid gem cocoapods >= 0

iOS crifan 4965浏览 0评论

折腾:

[已解决]Mac中尝试安装pod结果出错:-bash: pod: command not found

期间,使用:

gem install cocoapods

去安装cocoapods,结果出错:

licrifandeMacBook-Pro:inquzhou crifan$ gem install cocoapods
ERROR:  Could not find a valid gem ‘cocoapods’ (>= 0), here is why:
          Unable to download data from https://rubygems.org/ – Errno::ECONNRESET: Connection reset by peer – SSL_connect (https://rubygems.org/latest_specs.4.8.gz)
licrifandeMacBook-Pro:inquzhou crifan$ 

[解决过程]

1.网络连接启动shadowsocks代理再去试试:

licrifandeMacBook-Pro:inquzhou crifan$ gem install cocoapods
ERROR:  While executing gem … (Gem::DependencyError)
    Unable to resolve dependencies: cocoapods requires cocoapods-core (= 0.39.0), claide (~> 0.9.1), xcodeproj (~> 0.28.2), cocoapods-downloader (~> 0.9.3), cocoapods-plugins (~> 0.4.2), cocoapods-search (~> 0.1.0), cocoapods-stats (~> 0.6.2), cocoapods-try (~> 0.5.1), cocoapods-trunk (~> 0.6.4), molinillo (~> 0.4.0), colored (~> 1.2), escape (~> 0.0.4), activesupport (>= 4.0.2), nap (~> 1.0)

2.搜:

ERROR:  While executing gem … (Gem::DependencyError)

没解决。

3.加上sudo权限试试:

sudo gem install cocoapods

licrifandeMacBook-Pro:inquzhou crifan$ gem install cocoapods
ERROR:  Could not find a valid gem ‘cocoapods’ (>= 0), here is why:
          Unable to download data from https://rubygems.org/ – Errno::ECONNRESET: Connection reset by peer – connect(2) (https://rubygems.org/latest_specs.4.8.gz)
licrifandeMacBook-Pro:inquzhou crifan$ sudo gem install cocoapods
Password:
ERROR:  Could not find a valid gem ‘cocoapods’ (>= 0), here is why:
          Unable to download data from https://rubygems.org/ – SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A (https://rubygems.org/latest_specs.4.8.gz)

还是出错。

4.搜:

ERROR  Could not find a valid gem cocoapods

cocoapods安装与使用 – 万花筒 邪灵噶 的博客 – 博客频道 – CSDN.NET

如何使用CocoaPods – snowell – SegmentFault

去添加对应的http的源:

licrifandeMacBook-Pro:inquzhou crifan$ gem sources –add http://rubygems.org/
https://rubygems.org is recommended for security over http://rubygems.org/
Do you want to add this insecure source? [yn]  y

CocoaPods的安装使用和常见问题 – 简书

然后继续:

licrifandeMacBook-Pro:inquzhou crifan$ sudo gem install cocoapods
Password:
^CERROR:  Interrupted
licrifandeMacBook-Pro:inquzhou crifan$ gem sources
*** CURRENT SOURCES ***
licrifandeMacBook-Pro:inquzhou crifan$ sudo gem update –system
^CERROR:  Interrupted
licrifandeMacBook-Pro:inquzhou crifan$ gem sources –remove https://rubygems.org/
https://rubygems.org/ removed from sources
licrifandeMacBook-Pro:inquzhou crifan$ gem sources
*** CURRENT SOURCES ***
licrifandeMacBook-Pro:inquzhou crifan$ gem sources –add http://ruby.taobao.org/
Error fetching http://ruby.taobao.org/:
bad response Not Found 404 (http://ruby.taobao.org/specs.4.8.gz)
licrifandeMacBook-Pro:inquzhou crifan$ gem sources -l
*** CURRENT SOURCES ***

但是嫌弃国外的速度太慢

所以先去update:

先去更新:

licrifandeMacBook-Pro:inquzhou crifan$ sudo gem update –system
Updating rubygems-update
Fetching: rubygems-update-2.6.4.gem (100%)
Successfully installed rubygems-update-2.6.4
Parsing documentation for rubygems-update-2.6.4
Installing ri documentation for rubygems-update-2.6.4
Installing darkfish documentation for rubygems-update-2.6.4
Installing RubyGems 2.6.4
RubyGems 2.6.4 installed
Parsing documentation for rubygems-2.6.4
Installing ri documentation for rubygems-2.6.4
=== 2.6.3 / 2016-04-05
Minor enhancements:
* Lazily calculate Gem::LoadError exception messages. Pull request #1550
  by Aaron Patterson.
* New fastly cert. Pull request #1548 by David Radcliffe.
* Organize and cleanup SSL certs. Pull request #1555 by James Wen.
* [RubyGems] Make deprecation message for paths= more helpful. Pull
  request #1562 by Samuel Giddins.
* Show default gems when using "gem list". Pull request #1570 by Luis
  Sagastume.
Bug fixes:
* Stub ordering should be consistent regardless of how cache is populated.
  Pull request #1552 by Aaron Patterson.
* Handle cases when the @@stubs variable contains non-stubs. Pull request
  #1558 by Per Lundberg.
* Fix test on Windows for inconsistent temp path. Pull request #1554 by
  Hiroshi Shirosaki.
* Fix `Gem.find_spec_for_exe` picks oldest gem. Pull request #1566 by
  Shinichi Maeshima.
* [Owner] Fallback to email and userid when owner email is missing. Pull
  request #1569 by Samuel Giddins.
* [Installer] Handle nil existing executable. Pull request #1561 by Samuel
  Giddins.
* Allow two digit version numbers in the tests. Pull request #1575 by unak.
=== 2.6.2 / 2016-03-12
Bug fixes:
* Fix wrong version of gem activation for bin stub. Pull request #1527 by
  Aaron Patterson.
* Speed up gem activation failures. Pull request #1539 by Aaron Patterson.
* Fix platform sorting in the resolver. Pull request #1542 by Samuel E.
  Giddins.
* Ensure we unlock the monitor even if try_activate throws. Pull request
  #1538 by Charles Oliver Nutter.
=== 2.6.1 / 2016-02-28
Bug fixes:
* Ensure `default_path` and `home` are set for paths. Pull request #1513
  by Aaron Patterson.
* Restore but deprecate support for Array values on `Gem.paths=`. Pull
  request #1514 by Aaron Patterson.
* Fix invalid gem file preventing gem install from working. Pull request
  #1499 by Luis Sagastume.
=== 2.6.0 / 2016-02-26
Minor enhancements:
* RubyGems now defaults the `gem push` to the gem’s "allowed_push_host"
  metadata setting.  Pull request #1486 by Josh Lane.
* Update bundled Molinillo to 0.4.3. Pull request #1493 by Samuel E. Giddins.
* Add version option to gem open command. Pull request #1483 by Hrvoje
  Šimić.
* Feature/add silent flag. Pull request #1455 by Luis Sagastume.
* Allow specifying gem requirements via env variables. Pull request #1472
  by Samuel E. Giddins.
Bug fixes:
* RubyGems now stores `gem push` credentials under the host you signed-in for.
  Pull request #1485 by Josh Lane.
* Move `coding` location to first line. Pull request #1471 by SHIBATA
  Hiroshi.
* [PathSupport] Handle a regexp path separator. Pull request #1469 by
  Samuel E. Giddins.
* Clean up the PathSupport object. Pull request #1094 by Aaron Patterson.
* Join with File::PATH_SEPARATOR in Gem.use_paths. Pull request #1476 by
  Samuel E. Giddins.
* Handle when the gem home and gem path arent set in the config file. Pull
  request #1478 by Samuel E. Giddins.
* Terminate TimeoutHandler. Pull request #1479 by Nobuyoshi Nakada.
* Remove redundant cache. Pull request #1482 by Eileen M. Uchitelle.
* Freeze `Gem::Version@segments` instance variable. Pull request #1487 by
  Ben Dean.
* Gem cleanup is trying to uninstall gems outside GEM_HOME and reporting
  an error after it tries. Pull request #1353 by Luis Sagastume.
* Avoid duplicated sources. Pull request #1489 by Luis Sagastume.
* Better description for quiet flag. Pull request #1491 by Luis Sagastume.
* Raise error if find_by_name returns with nil. Pull request #1494 by
  Zoltán Hegedüs.
* Find_files only from loaded_gems when using gemdeps. Pull request #1277
  by Michal Papis.
RubyGems installed the following executables:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/gem
Ruby Interactive (ri) documentation was installed. ri is kind of like man
pages for ruby libraries. You may access it like this:
  ri Classname
  ri Classname.class_method
  ri Classname#instance_method
If you do not wish to install this documentation in the future, use the
‘gem help env’ for details.
RubyGems system software updated
licrifandeMacBook-Pro:inquzhou crifan$ 

再去添加淘宝试试:

还是404找不到。算了。

后来参考:

CocoaPods的安装使用和常见问题 – 简书

ruby – Unable to install ‘cocoapods’ gem from rubygems.org (bad response backend read error) – Stack Overflow

才发现,是https的taobao:

https://ruby.taobao.org/

不过算了,暂时用http的

http://rubygems.org/

暂时也是可以继续安装的,只是速度慢了点而已:

[已解决]sudo gem install cocoapods出错:ERROR While executing gem Errno EPERM Operation not permitted /usr/bin/xcodeproj

转载请注明:在路上 » [已解决]gem install cocoapods出错:ERROR Could not find a valid gem cocoapods >= 0

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
85 queries in 0.183 seconds, using 22.11MB memory