Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Could not find a valid gem in any repository" (rubygame and others)

Tags:

ruby

gem

rubygame

I've been trying to install this 'rubygame' gem for some time, but whenever I use the command

gem install rubygame

it will give an error:

ERROR:  Could not find a valid gem 'rubygame' (>= 0) in any repository
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
Errno::ETIMEDOUT: Connection timed out - connect(2) (http://rubygems.org/latest_specs.4.8.gz)

I've also tried other gems but with similar results:

ERROR:  Could not find a valid gem 'rake' (>= 0) in any repository
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
Errno::ETIMEDOUT: Connection timed out - connect(2) (http://rubygems.org/latest_specs.4.8.gz)

I've already made sure I have an internet connection, and have already tried reinstalling both ruby and rubygems (currently using ruby 1.8, rubygems 1.7.2). Googling didn't help me at all. I would be very grateful if anyone can solve my problem. My sources list only shows http://rubygems.org

like image 951
Reiswindy Avatar asked Apr 01 '12 05:04

Reiswindy


4 Answers

Check if you have "https://rubygems.org/" as a source to find gems at:

$ gem sources
*** CURRENT SOURCES ***

https://rubygems.org/

If not, you should be able to add it with

$ gem sources --add https://rubygems.org/
https://rubygems.org/ added to sources

Here are docs for the gem source command.

like image 74
Joshua Cheek Avatar answered Nov 15 '22 21:11

Joshua Cheek


You can also add the source you want on the command whenever you have troubles using https, like this:

gem install GEMNAME --source http://rubygems.org

It's better to fix the SSL problem though.

like image 51
Apprentice Avatar answered Nov 15 '22 20:11

Apprentice


are you behind any proxy?

check your browser for proxy that you might use:

execute the command: gem install xxx --http-proxy=http://user:password@server and you should be good to go.

like image 26
aakash Avatar answered Nov 15 '22 20:11

aakash


You don't have an Internet connection to rubygems.org.

This happens sometimes if the site is down or blocked.

This command can show you if your connection has a way to reach rubygems.org:

traceroute rubygems.org
like image 24
joelparkerhenderson Avatar answered Nov 15 '22 22:11

joelparkerhenderson