为什么 bundler 无法访问 http://rubygems.org?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10880857/
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
Why is bundler unable to reach http://rubygems.org?
提问by TangoKilo
Bundle install was working perfectly yesterday but now it's returning this output in the CL:
捆绑安装昨天运行良好,但现在它在 CL 中返回此输出:
~/dev/rails/sample_app$ bundle install
Fetching gem metadata from https://rubygems.org/.
Error Bundler::HTTPError during request to dependency API
Fetching full source index from https://rubygems.org/
Could not reach https://rubygems.org/
the only change I made to the gem file was to add the gem for factory girl (1.4.0) in the test group.
我对 gem 文件所做的唯一更改是在 test 组中为 factory girl (1.4.0) 添加了 gem。
I'm not working behind any proxies and I'm fully connected to the internet as well. Can't seem to find anything like this on google either. Any help would be much appreciated!
我没有在任何代理背后工作,而且我也完全连接到互联网。在谷歌上似乎也找不到这样的东西。任何帮助将非常感激!
采纳答案by Todd A. Jacobs
This is not a gem or ruby issue, this is a resolver issue, as you could tell from your uknown host rubygems.orgresponse.
这不是 gem 或 ruby 问题,这是一个解析器问题,正如您从您的uknown host rubygems.org回复中可以看出的那样。
If your browser is resolving, try sites like:
如果您的浏览器正在解析,请尝试以下网站:
to validate that your problem is localized.
验证您的问题是否已本地化。
回答by remjih
Is it working when you remove the new line ?
删除新行时是否有效?
Maybe, you should switch the Gemfile to use httpinstead of https
也许,你应该切换 Gemfile 来使用http而不是https
回答by DVG
Sounds like you may be behind a proxy server.
听起来您可能在代理服务器后面。
Try (unix/os x)
试试 (unix/os x)
$ export http_proxy=http://username:[email protected]:[your_proxy_port]
You may be able to get the info out of your web browser if you aren't aware of the values on your own.
如果您自己不知道这些值,您可以从 Web 浏览器中获取信息。
On windows, you can do this by going to Environment variables and adding a new one called http_proxy with the values above.
在 Windows 上,您可以通过转到环境变量并使用上述值添加一个名为 http_proxy 的新变量来完成此操作。

