“宝石安装轨”失败,DNS错误 [英] "gem install rails" fails with DNS error

查看:108
本文介绍了“宝石安装轨”失败,DNS错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$ rvm use
Using /home/owner/.rvm/gems/ruby-2.1.2
$ gem install rails
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ECONNREFUSED: Connection refused - connect(2) for "your-dns-needs-immediate-attention.network" port 80 (http://your-dns-needs-immediate-attention.network/quick/Marshal.4.8/thread_safe-0.3.4.gemspec.rz)
$ gem update --system
...
$ gem -v
2.4.1
$ gem install rails
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ECONNREFUSED: Connection refused - connect(2) for "your-dns-needs-immediate-attention.network" port 80 (http://your-dns-needs-immediate-attention.network/quick/Marshal.4.8/rails-4.1.5.gemspec.rz)


  1. 安装其他宝石(devise,activerecord)。我得到相同的错误。

  2. 重新安装RVM

  3. 运行 gem update --system / li>
  4. 将静态DNS设置为谷歌的8.8.8.8和8.8.4.4

  5. 添加 https://production.cf.rubygems。 org 作为宝石来源(见下面的错误)

  6. 在我之前的12.04中安装14.04。错误仍然存​​在。错误的来源必须在我的电脑之外。

  1. Installing other gems (devise, activerecord). I get the same error.
  2. Reinstalling RVM
  3. Running gem update --system
  4. Setting static DNS to google's 8.8.8.8 and 8.8.4.4
  5. Adding https://production.cf.rubygems.org as a gem source (see below for error)
  6. Installing 14.04 over my previous 12.04. Error persists. The source of the error must be outside my computer.



有关我的连接的其他信息:



Additional information about my connection:


  1. 我可以通过浏览器连接到 https://rubygems.org/

  2. 我的调制解调器的防火墙已完全禁用。

  3. $ curl -v --head https://rubygems.org 输出: http://pastebin.com/ca6DAvaU

  1. I can connect to https://rubygems.org/ through my browser
  2. My modem's firewall is completely disabled.
  3. $ curl -v --head https://rubygems.org output: http://pastebin.com/ca6DAvaU



我的/etc/resolv.conf



My /etc/resolv.conf

$ cat /etc/resolv.co
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 75.75.75.75
search home.network



添加直接宝石来源



参考: https://stackoverflow.com/a /3993分之19299266 020

owner@owner-Z87X-UD3H:~$ gem sources --add https://production.cf.rubygems.org
Error fetching https://production.cf.rubygems.org:
    Errno::ECONNREFUSED: Connection refused - connect(2) for "your-dns-needs-immediate-attention.network" port 443 (https://your-dns-needs-immediate-attention.network/specs.4.8.gz)



gem install rails的额外调试信息



Additional debug information for gem install rails

owner@owner-Z87X-UD3H:~$ gem install rails --debug -V
NOTE:  Debugging mode prints all exceptions even when rescued
Exception `LoadError' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/resolv.rb:169 - LoadError
HEAD https://api.rubygems.org/api/v1/dependencies
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/openssl/buffering.rb:182 - read would block
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=rails
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/openssl/buffering.rb:182 - read would block
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/openssl/buffering.rb:182 - read would block
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/openssl/buffering.rb:182 - read would block
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/openssl/buffering.rb:182 - read would block
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/openssl/buffering.rb:182 - read would block
200 OK
Exception `Resolv::DNS::Config::NXDomain' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/resolv.rb:547 - _rubygems._tcp.api.rubygems.org
Exception `Errno::ECONNREFUSED' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/net/http.rb:879 - Connection refused - connect(2) for "your-dns-needs-immediate-attention.network" port 443
Exception `Gem::RemoteFetcher::FetchError' at /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/remote_fetcher.rb:286 - Errno::ECONNREFUSED: Connection refused - connect(2) for "your-dns-needs-immediate-attention.network" port 443 (https://your-dns-needs-immediate-attention.network/quick/Marshal.4.8/rails-4.1.5.gemspec.rz)
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ECONNREFUSED: Connection refused - connect(2) for "your-dns-needs-immediate-attention.network" port 443 (https://your-dns-needs-immediate-attention.network/quick/Marshal.4.8/rails-4.1.5.gemspec.rz)
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/remote_fetcher.rb:286:in `rescue in fetch_path'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/remote_fetcher.rb:259:in `fetch_path'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/source.rb:146:in `fetch_spec'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/resolver/api_specification.rb:76:in `spec'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/resolver/installer_set.rb:77:in `add_always_install'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/dependency_installer.rb:461:in `resolve_dependencies'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/commands/install_command.rb:238:in `install_gem'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/commands/install_command.rb:299:in `block in install_gems'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/commands/install_command.rb:295:in `each'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/commands/install_command.rb:295:in `install_gems'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/commands/install_command.rb:202:in `execute'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/command.rb:307:in `invoke_with_build_args'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/command_manager.rb:168:in `process_args'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/command_manager.rb:138:in `run'
    /home/owner/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/gem_runner.rb:54:in `run'
    /home/owner/.rvm/rubies/ruby-2.1.2/bin/gem:21:in `<main>'


推荐答案

blasio 似乎Xfinity调制解调器正在将搜索域设置为 home.network ,这是因为他提到的原因而麻烦的(实质上,home.network现在是有效的调制解调器在进行连接之前尝试联系的域名)。

Like blasio pointed out. It seems like the Xfinity modems are setting up the search domain to home.network and this is messing things up for the reasons he mentioned (essentially, home.network is now a valid domain name that the modems are trying to contact before making a connection).

我有同样的问题,并且在resolv.conf上的修改似乎是诀窍,这应该是Linux接受的解决方案。我在运行ubuntu的虚拟机上尝试这个问题时遇到了这个问题,我的主机(OSX Mavericks)正像传统调制解调器那样传递了 search home.network ,所以我想查看是否可以在主机操作系统级别找到可以完成的解决方案,因为当我在OSX终端上尝试 gem install rails 时发生同样的问题。

I had the same problem and the modification on resolv.conf seem to do the trick, and that should probably be an accepted solution for linux environments. I had this problem while attempting this on a virtual machine running ubuntu, and my host(OSX Mavericks) was passing down the search home.network like the modem is, so I wanted to see if I could find a solution that could be done at the host OS level because the same problem happened when I attempted gem install rails on my OSX terminal.

如果您进入OSX网络设置,请在DNS下看到 home.network 搜索域名。经过一些搜索,似乎comcast最近从 http://hds1.ma.comcast.net'更改了这个。我改变了它,重新启动,并给了 gem install rails 另一个镜头,这没有任何问题。

If you go to the OSX network settings, under DNS you'll see the home.network line under the Search Domains area. After some googling it seems that comcast recently changed this from http://hds1.ma.comcast.net'. I changed it back, restarted and gave gem install rails another shot, which worked with no problem.

奇怪的问题,但这是一个更好的解决方案,交换调制解调器或更改宝石来源。

Strange issue but this is a better solution that swapping modems or changing gem sources.

这篇关于“宝石安装轨”失败,DNS错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆