tags:

views:

4489

answers:

5

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?

+6  A: 

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: http://stackoverflow.com/questions/4418/how-do-i-update-ruby-gems-from-behind-a-proxy-isa-ntlm

Tomas Markauskas
Yes, my browser uses automatic configuration. Is there some way to tell "gem" to use a proxy? Ah, I see you've added a link for me. Thanks! :)
mike
As written in one of the answers to the linked question, you could try `gem install --http-proxy http://localhost:3128 _name_of_gem_`
Tomas Markauskas
Just replace `localhost:3128` with the actual proxy server address and port.
Tomas Markauskas
Thanks! That works great!
mike
+1  A: 

if your proxy requires authentication, then use: gem install --http-proxy http://USERNAME:PASS@HOST:PORT gem_name

dgt
A: 

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.

rogerdpack
A: 

Sample: sudo gem install nifty-generators -p http://proxy:port, it works well

Marlon Lopes
A: 

set http_proxy=http://xx.xxx.xxx.xx:80

wyderp