捆绑安装无法从 https://rubygems.org/ 获取规范
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15194481/
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
Bundle Install could not fetch specs from https://rubygems.org/
提问by Steven
I'm attempting to follow the Hartl Rails Tutorial, and having trouble with the bundler gem.
我正在尝试遵循 Hartl Rails 教程,但在使用 bundler gem 时遇到了问题。
When using the commands 'bundle install' or 'bundle update' I get the following output:
使用命令“捆绑安装”或“捆绑更新”时,我得到以下输出:
Fetching source index from https://rubygems.org/
Could not fetch specs from https://rubygems.org/
从https://rubygems.org/获取源索引
无法从https://rubygems.org/获取规格
I've searched for this output, but did not find many related issues online.
我已经搜索了这个输出,但没有在网上找到很多相关问题。
Maybe I have another gem that is interrupting bundler? I have little experience with rails at this point.
也许我有另一个干扰捆绑器的宝石?在这一点上,我对 Rails 几乎没有经验。
source 'https://rubygems.org'
gem 'rails', '3.2.12'
group :development do
gem 'sqlite3', '1.3.5'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.2'
The solution for me was two parts:I changed https to http, and that temporarily solved the issue. The second issue was that I think I had a bad install of ruby 2.0.0 even though I was using a fresh install of ruby 1.9.3. So I reinstalled ruby 2.0.0, and I could use bundle install with https.
我的解决方案有两部分:我将 https 更改为 http,这暂时解决了问题。第二个问题是,尽管我使用的是全新安装的 ruby 1.9.3,但我认为我安装的 ruby 2.0.0 是错误的。所以我重新安装了 ruby 2.0.0,我可以使用 https 捆绑安装。
回答by ldl
I had the same issue. The only working solution I found was to force http instead of https in Gemfile:
我遇到过同样的问题。我发现的唯一可行的解决方案是在 Gemfile 中强制使用 http 而不是 https:
source 'http://rubygems.org'
回答by WebDragon
Just in case none of the above satisfies the next intrepid explorer, I thought I'd drop here that after I spent 4 hours on this doing variants of the search that landed me here, I finally discovering that IPV6 was the culprit, after finding this specific thread on help.rubygems.org. Solution? this (Fedora, Linux):
以防万一以上都不能满足下一个勇敢的探索者,我想我会在这里,在我花了 4 个小时做这个搜索的变体之后,我终于发现 IPV6 是罪魁祸首,在找到这个之后help.rubygems.org 上的特定线程。解决方案?这个(Fedora,Linux):
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
set up a shell script to flip IPV6 on and off so I could run a command without it, and now everything runs peachy.
设置一个 shell 脚本来打开和关闭 IPV6,这样我就可以在没有它的情况下运行命令,现在一切都运行良好。
回答by Dminds
you can try the following, if in windows:
如果在 Windows 中,您可以尝试以下操作:
set HTTP_PROXY= <your proxy address without http://>
set HTTPS_PROXY=%HTTP_PROXY%
For eg:
例如:
HTTP_PROXY=mycompany.myproxy.com:8080
HTTPS_PROXY=%HTTP_PROXY%
Worked for me
对我来说有效
回答by Aziz Zoaib
It can be temporary network issue as well. Try restarting network services using command
它也可能是暂时的网络问题。尝试使用命令重新启动网络服务
service network restart
If its *nix machine.
如果它的 *nix 机器。
回答by Artur_PL
The other reason causing such that issues is the fact if you are behind proxy server. I describe here solution, maybe it will be usefull for someone else. :)
导致此类问题的另一个原因是您在代理服务器后面。我在这里描述解决方案,也许对其他人有用。:)
In case that you did not know Login/pass for yours proxy, and meet this issues you could firstly check if you need to (re)install anything, by command:
如果您不知道您的代理的登录/密码,并且遇到此问题,您可以首先通过命令检查是否需要(重新)安装任何东西:
C:\...> bundle check
Resolving dependencies...
The Gemfile's dependencies are satisfied
If you get other respons then above, you could find properly gems in properly versions here (rubygems.org), then install it (from the directory with downloaded gem) by command:
如果您在上面得到其他响应,您可以在此处 (rubygems.org)找到正确版本中的正确 gem ,然后通过命令安装它(从下载 gem 的目录中):
gem install <gem-name> --locally
回答by mindriot
I had the same issue using ruby-2.0.0-p247on OS X 10.8.5.
我ruby-2.0.0-p247在 OS X 10.8.5 上使用时遇到了同样的问题。
Make sure the first line in Gemfileis using https://
确保第一行Gemfile正在使用https://
source 'https://rubygems.org'
I reinstalled that version of ruby.
我重新安装了那个版本的 ruby。
rvm reinstall ruby-2.0.0
Ruby was upgraded ruby-2.0.0-p598(version depends on latest patch).
Ruby 已升级ruby-2.0.0-p598(版本取决于最新补丁)。
bundlethen worked without error although all the gems were reinstalled.
bundle然后虽然重新安装了所有宝石,但没有错误地工作。
回答by Jeremy Gunter
I had this issue while working in Cloud 9. After trying several 'bundle install' and sending an email to c9 support(no reply) I was able to get it working by killing all the processes and doing a hard-restart of the IDE.
我在 Cloud 9 中工作时遇到了这个问题。在尝试了几次“捆绑安装”并向 c9 支持发送电子邮件(没有回复)后,我能够通过终止所有进程并硬重启 IDE 来使其工作。
Do this by clicking directly on the little bar-graphs at the top of the right-hand side that show CPU, Memory, Disk. Then click on the process list, select them all, and force kill. Then exit out of the process list. Click on the bar-graphs again, and this time click 'Restart'.
为此,请直接单击右侧顶部显示 CPU、内存、磁盘的小条形图。然后点击进程列表,全选,强行杀掉。然后退出进程列表。再次单击条形图,这次单击“重新启动”。
After this I was able to run bundle with no problems.
在此之后,我能够毫无问题地运行 bundle。
回答by Akash Kumar
Sometimes it happens due to proxy you are using.
I tried to resolve this by using a connection without proxy and all worked perfectly fine.
Then try:
有时它是由于您使用的代理而发生的。我试图通过使用没有代理的连接来解决这个问题,并且一切正常。
然后尝试:
bundle update
And then go for
然后去
bundle install
回答by Geisimar Rech
Either with http or https did not work.
使用 http 或 https 都不起作用。
After I disabled the IP v6, it worked
禁用 IP v6 后,它起作用了
回答by Andrewjs
If you are using Cloud9, just restart (command R) and try again
如果您使用的是 Cloud9,只需重新启动(命令 R)并重试

