Thursday, November 1, 2012

Unable to install gems when using gem version 1.8.24 on windows


So, i just upgraded my ruby to 1.9.3, and installed the latest gem version 1.8.4.

After installing DevKit and everything i tried to install rails on my system. I wrote

gem install rails

and after a second got this error

ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    SocketError: getaddrinfo: No such host is known.  (http://rubygems.org/latest_specs.4.8.gz)

ERROR:  Could not find a valid gem 'rails' (>= 0) in any repository
ERROR:  Possible alternatives: rails




So i researched about it a little, and got to know that this happens when you're behind a proxy. But as i wasn't using any proxy this made no sense to me.

So i dug in a little deeper and found this option  "--no-http-proxy".

Then i tried to install rails using this option

gem install rails --no-http-proxy

and voila, everything started working fine. This was it.

Also if you still get an error after adding the above option regarding dependencies, you can add an option "--include-dependencies" to install all the dependencies as well.

gem install rails --no-http-proxy --include-dependencies


No comments:

Post a Comment