Ruby on Rails,找不到有效的 gem 'rails'
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16944224/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ruby on Rails, could not find a valid gem 'rails'
提问by morg
I installed ruby and updated ruby gems, now I want to download rails 3.2.13. I write gem install rails -v 3.2.13 (I need this version) I have this error
我安装了 ruby 并更新了 ruby gems,现在我想下载 rails 3.2.13。我写 gem install rails -v 3.2.13 (我需要这个版本)我有这个错误
ERROR: Could not find a valid gem 'rails' (= 3.2.13), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect SYSCA
LL returned=5 errno=0 state=SSLv2/v3 read server hello A (https://rubygems.org/s
pecs.4.8.gz)
ERROR: Possible alternatives: rails
I read on internet that maybe downloading gem httpclient it could work, but I did not manage to download it (another error) Do you know how I could fix this?
我在互联网上读到也许下载 gem httpclient 它可以工作,但我没有设法下载它(另一个错误)你知道我该如何解决这个问题吗?
回答by beginning
do this:
做这个:
gem sources -a http://rubygems.org
then answer y for
然后回答y
Do you want to add this insecure source? [yn]
lastly,
最后,
gem install rails
hope that helps :)
希望有帮助:)
回答by user2503775
I had a similiar error.
我有一个类似的错误。
Try in your Gemfile:
在你的 Gemfile 中尝试:
source 'http://rubygems.org'
Instead of:
代替:
source 'https://rubygems.org'
That solved my problem...
那解决了我的问题...
回答by user1208639
see if you can get this to work "wget rubygems.org/downloads/rails-3.2.13.gem"
看看你是否可以让它工作“wget rubygems.org/downloads/rails-3.2.13.gem”
That worked for me, but Vimsha did not explain how to install the gem once you've downloaded it. It's quite easy:
这对我有用,但 Vimsha 没有解释一旦你下载了 gem 后如何安装它。这很容易:
gem install rails-3.2.13.gem
installs the gem and other gems that it depends on.
安装它所依赖的 gem 和其他 gem。
This is where I got that information from:
这是我从以下位置获取信息的地方:
回答by Florian Winkler
The answer and methodology can be found on http://guides.rubygems.org/ssl-certificate-update/
答案和方法可以在http://guides.rubygems.org/ssl-certificate-update/上找到
Skip to "INSTALLING USING UPDATE PACKAGES (NEW)" and follow the instructions
跳到“安装使用更新包(新)”并按照说明进行操作
Newest RubyGem can be found at https://rubygems.org/pages/download
最新的 RubyGem 可以在https://rubygems.org/pages/download找到
回答by Mutuma
I had the same problem but turns out I had a proxy setup but I was trying to download gems from a proxyless network
我遇到了同样的问题,但事实证明我有一个代理设置,但我试图从无代理网络下载 gems
First, Detect if you have any proxy setup. Do
首先,检测您是否有任何代理设置。做
env | grep -i proxy
If this command prints something on STDOUT on the terminal e.g. in my case
如果此命令在终端上的 STDOUT 上打印某些内容,例如在我的情况下
http_proxy=http://proxy.abcde.ac.za:80/
https_proxy=https://proxy.abcde.ac.za:80/
Do
做
unset http_proxy
unset https_proxy
This unsets the proxy environment variables to null so when you do env | grep -i proxythere should be no output.
这会将代理环境变量设置为 null,因此当您执行env | 时 grep -i proxy应该没有输出。
Now run
现在运行
gem install [gemname]

