How can I get past “http://gems.rubyforge.org/ doe

2019-01-17 21:29发布

问题:

Question 828421 asked similar question, but received only one real answer (update rubygems) and that attempt results in the same error.

Ruby version 1.9.1.p243 on Windows. Included Gem, version 1.3.5. Never installed any gems before; never did any special config for this Ruby. Ruby itself works, as does irb, and "gem" operates but can't do install (and maybe other ops).

Tried this (from a book):

gem install rspec

Got this:

ERROR: http://gems.rubyforge.org/ does not appear to be a repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) SocketError: getaddrinfo: The storage control blocks were destroyed. (http://gems.rubyforge.org/yaml)

When I go to that URL (without "yaml") using MSIE7, I get a page titled "Gemcutter | awesome gem hosting" and have no problem wandering around that site. So I don't -think- it's a proxy problem (though this is all from inside corporate firewall/proxies/etc).

When I go to that URL -with- "yaml", it goes to "http://production.s3.rubygems.org/yaml" and shows what I assume is an update specification page, starting with this: --- !ruby/object:Gem::SourceIndex

I didn't destroy any "storage control blocks". So what is preventing gem from installing a gem?

Web search shows MANY people having this same problem over a long span of time, but I have yet to see anyone say "It's because of THIS, so do THIS to fix it." Well, someone suggested updating "gem", but trying that gets same error.

Help please?

回答1:

Your browser might be using system-wide proxy settings or some sort of automatic configuration. The gem command probably doesn't. I'm behind an university proxy and I can't install/update any gems normally, but can access everything with my browser. To install gems, I normally create a tunnel to my server so I can bypass the proxy server.

This might help you to configure the proxy settings for the gem command: How do I update Ruby Gems from behind a Proxy (ISA-NTLM)



回答2:

Sample:

sudo gem install nifty-generators -p http://proxy:port

It works well.



回答3:

If your proxy requires authentication, then use:

gem install --http-proxy http://USERNAME:PASS@HOST:PORT gem_name


回答4:

This can "at times" mean that for some reason rubygems.org is down currently, and so your local "invisible proxy" is returning you a 404 or what not.



回答5:

@Tomas Markauskas didn't work for me because i'm not behind a proxy. And I didn't find a solution anywhere, I tried disable my AV and firewall, didn't

This was the solution for me:

gem install rails -r -w -p

Hope this will help people with the same problem.

EDIT: I have Windows 7 64bit.



标签: ruby rubygems