V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
chuhades
V2EX  ›  Ruby

无法安装 bundler

  •  
  •   chuhades · 2015-05-22 03:00:27 +08:00 · 5253 次点击
    这是一个创建于 3468 天前的主题,其中的信息可能已经有所发展或是发生改变。

    环境:
    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 不可以,求解决。

    10 条回复    2016-11-21 17:08:52 +08:00
    chuhades
        1
    chuhades  
    OP
       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
        2
    046569  
       2015-05-22 03:07:35 +08:00
    怀疑 DNS 故障,考虑换个 DNS 或者开梯子试试?
    chuhades
        3
    chuhades  
    OP
       2015-05-22 03:12:27 +08:00
    @046569 不是的,试过了8.8.8.8,和alidns,都还是不行。
    046569
        4
    046569  
       2015-05-22 03:16:12 +08:00
    @chuhades
    你那两个 DNS 有可能被运营商污染了(如果你没使用加密, Google 的一定被污染).开梯子排查最节省时间.梯子速度快的话,官方源比淘宝源还快...
    046569
        5
    046569  
       2015-05-22 03:28:57 +08:00   ❤️ 1

    测试无误.
    chuhades
        6
    chuhades  
    OP
       2015-05-22 04:00:05 +08:00
    @046569 加了梯子也还是不行,shadowsocks...
    liprais
        7
    liprais  
       2015-05-22 09:00:17 +08:00 via iPhone
    https => http 试试?
    halczy
        8
    halczy  
       2015-05-22 09:48:25 +08:00
    需要全局代理才行, RubyGems的服务器被污染了.
    chuhades
        9
    chuhades  
    OP
       2015-05-23 19:38:37 +08:00
    把项目删除,重新clone了下,然后重装了ruby,就可以了,不知道为什么。
    感谢楼上各位~
    FrankFang128
        10
    FrankFang128  
       2016-11-21 17:08:52 +08:00
    我也遇到了, rbenv 的 ruby 报错,系统自带的就不报错。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3352 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 00:49 · PVG 08:49 · LAX 16:49 · JFK 19:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.