“gem install rails” fails with DNS error

后端 未结 14 684
我在风中等你
我在风中等你 2020-12-01 07:59
$ rvm use
Using /home/owner/.rvm/gems/ruby-2.1.2
$ gem install rails
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ECONNREFUSED: Connec         


        
相关标签:
14条回答
  • 2020-12-01 08:42

    For me "your-dns-needs-immediate-attention", actually meant "your gem sources are not valid".

    gem source --list
    

    Check the output. If the current list isn't valid, then you can simply

    gem source -a https://rubygems.org
    

    ...or whatever other sources are appropriate. Then use the -r flag to remove the invalid sources.

    0 讨论(0)
  • 2020-12-01 08:43

    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).

    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.

    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.

    0 讨论(0)
  • 2020-12-01 08:43

    Replace the modem Comcast provided with another (Motorola Surfboard SB6141 in this case).

    This is an unsatisfying solution, but a solution nonetheless.

    0 讨论(0)
  • 2020-12-01 08:45

    FWIW, if anyone's encountering this in Windows, here's how I fixed it (in 8.1).

    1. Go to Control Panel\Network and Internet\Network and Sharing Center
    2. Click into your network adaptor's status, and from there into its properties
    3. Double click the IPv4 item
    4. In the IPv4 Properties, click Advanced...
    5. In the DNS tab, look for the 'home.network' suffix, and remove it.
    6. Hit OK a bunch of times :)

    Now you should be good to go!

    0 讨论(0)
  • 2020-12-01 08:47

    Your DNS error seems to be related to .network becoming a TLD and your resolv.conf missing the ndots configuration. I just run into this issue with .prod.

    Unless you have your own DNS server at home for internal .network domain, removing the search home.network from /etc/resolv.conf should fix the issue.

    Since your /etc/resolv.conf is generated by resolveconf as it says in your resolv.conf, you might want to remove the home.network from your configuration, see here for example

    0 讨论(0)
  • 2020-12-01 08:49

    If you work on a Mac system, you can try to

    sudo vi /etc/resolv.conf

    by edit search statement with appending .local to a word.

    EX:

    # This file is automatically generated.
    #
    search network.local
    

    NOTE: Above network is the domain for this case. You can use any word.

    0 讨论(0)
提交回复
热议问题