问题
For some reason, I can't add new gems (which haven't been donwloaded/used before) to my system. When I run bundle install
after adding them to the Gemfile
, I get errors like this:
/usr/lib/ruby/1.8/rubygems/remote_fetcher.rb:180:in `fetch_path': SocketError: getaddrinfo: Name or service not known (http://rubygems.org/quick/Marshal.4.8/google_places_autocomplete-0.0.2.gemspec.rz) (Gem::RemoteFetcher::FetchError) from /usr/lib/ruby/1.8/rubygems/spec_fetcher.rb:106:in `fetch_spec'
from /var/lib/gems/1.8/gems/bundler-1.0.14/lib/bundler/remote_specification.rb:47:in `_remote_specification'
from /var/lib/gems/1.8/gems/bundler-1.0.14/lib/bundler/remote_specification.rb:53:in `method_missing'
from /var/lib/gems/1.8/gems/bundler-1.0.14/lib/bundler/resolver.rb:101:in `__dependencies'
from /var/lib/gems/1.8/gems/bundler-1.0.14/lib/bundler/resolver.rb:98:in `each'
from /var/lib/gems/1.8/gems/bundler-1.0.14/lib/bundler/resolver.rb:98:in `__dependencies'
....
from /var/lib/gems/1.8/bin/bundle:19
This just happened out of the blue. All the gems I'm trying are from the official rubygems.org
website. It's always the same exact error (just with the gem name changed in the URL on the first line). If I run bundle install
without adding any new gems, it works fine.
Does anyone have any insight on how to fix this?
回答1:
@eugen Thank you. Yes rubygems.org was reachable, but my DNS servers were configured incorrectly. I added an openDNS server (8.8.8.8) to my DNS servers in my network preferences, now it works fine.
回答2:
I ran into this error and removed my Gemfile.lock. This fixed it. It might not be acceptable for everyone, but it worked in my situation.
回答3:
Has this same error. Looks like re-fetching fixed it.
来源:https://stackoverflow.com/questions/6846059/ruby-on-rails-cant-download-new-gems-name-or-service-not-known