无法安装 bundler

2015-05-22 03:00:27 +08:00
 chuhades

环境:
os x 10.10.3
ruby 版本:通过rbenv 安装的2.1.6
source: https://ruby.taobao.org/

➜  metasploit-framework git:(master) ruby -v
ruby 2.1.6p336 (2015-04-13 revision 50298) [x86_64-darwin14.0]
➜  metasploit-framework git:(master) rbenv which gem
/Users/chu/.rbenv/versions/2.1.6/bin/gem
➜  metasploit-framework git:(master) gem install bundler
ERROR:  Could not find a valid gem 'bundler' (>= 0), here is why:
          Unable to download data from https://ruby.taobao.org/ - no such name (https://ruby.taobao.org/latest_specs.4.8.gz)

但是疑惑的是,本级还装了2.2.2版本的ruby,它就可以进行安装,默认自带的也可以,只有2.1.6 不可以,求解决。

5283 次点击
所在节点    Ruby
10 条回复
chuhades
2015-05-22 03:02:32 +08:00
报错是 no such name,感觉很疑惑,附相信错误信息:
➜ metasploit-framework git:(master) gem install bundler --debug
Exception `LoadError' at /Users/chu/.rbenv/versions/2.1.6/lib/ruby/2.1.0/resolv.rb:169 - LoadError
Exception `Resolv::DNS::Config::NXDomain' at /Users/chu/.rbenv/versions/2.1.6/lib/ruby/2.1.0/resolv.rb:547 - _rubygems._tcp.ruby.taobao.org
Exception `Resolv::DNS::Config::NXDomain' at /Users/chu/.rbenv/versions/2.1.6/lib/ruby/2.1.0/resolv.rb:547 - _rubygems._tcp.ruby.taobao.org.local
Exception `Resolv::ResolvError' at /Users/chu/.rbenv/versions/2.1.6/lib/ruby/2.1.0/resolv.rb:492 - DNS result has no information for _rubygems._tcp.ruby.taobao.org
Exception `Errno::EEXIST' at /Users/chu/.rbenv/versions/2.1.6/lib/ruby/2.1.0/fileutils.rb:250 - File exists @ dir_s_mkdir - /Users/chu/.gem/specs/ruby.taobao.org%443
Exception `SocketError' at /Users/chu/.rbenv/versions/2.1.6/lib/ruby/2.1.0/net/http.rb:879 - getaddrinfo: Invalid value for ai_flags
Exception `Gem::RemoteFetcher::UnknownHostError' at /Users/chu/.rbenv/versions/2.1.6/lib/ruby/2.1.0/rubygems/remote_fetcher.rb:283 - no such name (https://ruby.taobao.org/latest_specs.4.8.gz)
Exception `Gem::RemoteFetcher::UnknownHostError' at /Users/chu/.rbenv/versions/2.1.6/lib/ruby/2.1.0/rubygems/spec_fetcher.rb:268 - no such name (https://ruby.taobao.org/latest_specs.4.8.gz)
Exception `Gem::SpecificGemNotFoundException' at /Users/chu/.rbenv/versions/2.1.6/lib/ruby/2.1.0/rubygems/dependency_installer.rb:297 - Could not find a valid gem 'bundler' (>= 0) locally or in a repository
ERROR: Could not find a valid gem 'bundler' (>= 0), here is why:
Unable to download data from https://ruby.taobao.org/ - no such name (https://ruby.taobao.org/latest_specs.4.8.gz)
Exception `Errno::EEXIST' at /Users/chu/.rbenv/versions/2.1.6/lib/ruby/2.1.0/fileutils.rb:250 - File exists @ dir_s_mkdir - /Users/chu/.gem/specs/ruby.taobao.org%443
Exception `SocketError' at /Users/chu/.rbenv/versions/2.1.6/lib/ruby/2.1.0/net/http.rb:879 - getaddrinfo: Invalid value for ai_flags
Exception `Gem::RemoteFetcher::UnknownHostError' at /Users/chu/.rbenv/versions/2.1.6/lib/ruby/2.1.0/rubygems/remote_fetcher.rb:283 - no such name (https://ruby.taobao.org/prerelease_specs.4.8.gz)
Exception `Errno::EEXIST' at /Users/chu/.rbenv/versions/2.1.6/lib/ruby/2.1.0/fileutils.rb:250 - File exists @ dir_s_mkdir - /Users/chu/.gem/specs/ruby.taobao.org%443
Exception `SocketError' at /Users/chu/.rbenv/versions/2.1.6/lib/ruby/2.1.0/net/http.rb:879 - getaddrinfo: Invalid value for ai_flags
Exception `Gem::RemoteFetcher::UnknownHostError' at /Users/chu/.rbenv/versions/2.1.6/lib/ruby/2.1.0/rubygems/remote_fetcher.rb:283 - no such name (https://ruby.taobao.org/specs.4.8.gz)
Exception `Gem::RemoteFetcher::UnknownHostError' at /Users/chu/.rbenv/versions/2.1.6/lib/ruby/2.1.0/rubygems/spec_fetcher.rb:268 - no such name (https://ruby.taobao.org/specs.4.8.gz)
046569
2015-05-22 03:07:35 +08:00
怀疑 DNS 故障,考虑换个 DNS 或者开梯子试试?
chuhades
2015-05-22 03:12:27 +08:00
@046569 不是的,试过了8.8.8.8,和alidns,都还是不行。
046569
2015-05-22 03:16:12 +08:00
@chuhades
你那两个 DNS 有可能被运营商污染了(如果你没使用加密, Google 的一定被污染).开梯子排查最节省时间.梯子速度快的话,官方源比淘宝源还快...
046569
2015-05-22 03:28:57 +08:00

测试无误.
chuhades
2015-05-22 04:00:05 +08:00
@046569 加了梯子也还是不行,shadowsocks...
liprais
2015-05-22 09:00:17 +08:00
https => http 试试?
halczy
2015-05-22 09:48:25 +08:00
需要全局代理才行, RubyGems的服务器被污染了.
chuhades
2015-05-23 19:38:37 +08:00
把项目删除,重新clone了下,然后重装了ruby,就可以了,不知道为什么。
感谢楼上各位~
FrankFang128
2016-11-21 17:08:52 +08:00
我也遇到了, rbenv 的 ruby 报错,系统自带的就不报错。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/192869

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX