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

六月ゝ 毕业季﹏ 提交于 2019-11-27 11:05:39
Joshua Cheek

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.

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.

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.

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

Maybe you should try

gem list -r

then

gem install -r rubygame

Also note that with rvmon MacosX (Lion in my case) you should install ruby-1.9.3-p194 (for Xcode 4.x compiler considerations) then

rvm rubygems current

and in my case I had to use

rvm use ruby-1.9.3-p194@global

(which contains bundler, rake, rubygems-bundlerand rvm)

and not

rvm use ruby-1.9.3-p194

(which is empty)

I have fixed this issue using the proxy command option of gem install. It has the following format:

$ gem install --http-proxy http://201.187.107.19:8080 rubygame

Note, the IP address and the port number refers to a proxy. You should search for a proxy list and use one of the proxies there.

This is site with proxies: http://www.cybersyndrome.net/pla5.html

Also, I have to try 7 or 8 different proxies in order to succeed. Do not give up.

joelparkerhenderson

Can you post your versions?

ruby -v
#=> ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]

gem -v
#=> 1.8.19

If your gem command is not current, you can update it like this:

gem update --system

To see if you can connect to rubygems.org using Ruby:

require 'net/http'
require 'uri'
puts Net::HTTP.get URI.parse('https://rubygems.org')

If yes, that's good.

If no, then somehow Ruby is blocked from opening a net connection. Try these and see if any of them work:

curl https://rubygems.org

curl https://rubygems.org --local-port 1080

curl https://rubygems.org --local-port 8080

env | grep -i proxy

If you're using a company machine, or within a company firewall, or running your own firewall, you may need to use a proxy.

For info on Ruby and proxies see http://www.linux-support.com/cms/http-proxies-and-ruby/


I know this is a little late, but I was also having this issue a while ago. This is what worked for me:

REALLY_GEM_UPDATE_SYSTEM=1 
sudo gem update --system
sudo gem install rails

Hope this helps anyone else having this issue :)

Use :

gem sources --add http://rubygems.org/

Do you want to add this insecure source? [yn] [YES]

then use

gem install sass

and done

I have tried most of the solutions suggested here but I had no luck. I found a solution that worked for me, which was manually updating the gemfile to 2.6.7. The guide on how to do is in guides.rubygems.org: installing-using-update-packages

Download rubygems-update-2.6.7.gem to your C:\

Now, using your Command Prompt:

C:\>gem install --local C:\rubygems-update-2.6.7.gem
C:\>update_rubygems --no-ri --no-rdoc 

After this, gem --version should report the new update version (2.6.7).

You can now safely uninstall rubygems-update gem:

C:\>gem uninstall rubygems-update -x
Removing update_rubygems
Successfully uninstalled rubygems-update-2.6.7

The reason why this did not work before was because server used certificates SHA-1, now this was updated to SHA-2.

For what it is worth I came to this page because I had the same problem. I never got anywhere except some IMAP stuff that I don't understand. Then I remembered I had uninstalled privoxy on my ubuntu (because of some weird runtime error that mentioned 127.0.0.1:8118 when I used Daniel Kehoe's Rails template, https://github.com/RailsApps/rails3-application-templates [never discovered what it was]) and I hadn't changed my terminal to the state of no system wide proxy, under network proxy.

I know this may not be on-point but if I wound up here maybe other privoxy users can benefit too.

check your DNS settings ...I was facing similar problem ... when I checked my /etc/resolve.config file ,the name server was missing ... after adding it the problem gets resolved

This worked for me to bypass the proxy definitions:

1) become root

2) gem install -u gem_name gem_name

Hope you can work it out

Make sure you type the command from the "App" Directory

I tried to install a gem which is for JRuby only, running into the same error. Using jruby's command worked then:

jruby -S gem install some_jruby_gem

If you are running behind the any firewall(if firewall blocking gem installation). just try following command it works.

 gem install --http-proxy http://username:pwd@server:port gem

It is a permission issue.

try with sudo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!