不是 gzip 格式错误
在安装任何 Gem 或执行任何 Gem gzip 列表时,出现与 gzip 相关的错误,如下所示:-
C:\Documents and Settings\gangunra>gem install rhosync -v 2.0.0.beta7 --pre
ERROR: While executing gem ... (Zlib::GzipFile::Error)
not in gzip format
C:\Documents and Settings\gangunra>gem list rails -r
*** REMOTE GEMS ***
ERROR: While executing gem ... (Zlib::GzipFile::Error)
not in gzip format
请帮我解决如何解决此问题
while installing any Gem or doing any listing of gem gzip related error comes as shown below:-
C:\Documents and Settings\gangunra>gem install rhosync -v 2.0.0.beta7 --pre
ERROR: While executing gem ... (Zlib::GzipFile::Error)
not in gzip format
C:\Documents and Settings\gangunra>gem list rails -r
*** REMOTE GEMS ***
ERROR: While executing gem ... (Zlib::GzipFile::Error)
not in gzip format
Please help me out how to reslove this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
看起来 rubygems.org(或您定义的任何 gem 源)已关闭。
Looks like rubygems.org (or any gem source you have defined) is down.
不确定您的错误是否发生在
tar_input.rb
或ruby_core_source.rb
中。大多数人通过清理缓存文件来解决
tar_input.rb
错误。我解决了 ruby_core_source.rb:57 'initialize' 的问题:不是 gzip 格式这里是描述和解决方法:
问题是因为“有时”ftp 服务器中的 ruby 源文件可能不是 tar + gzip。所以有时候源文件是不正确的。
我刚刚浏览了源代码,代码需要 ftp 服务器中的 .tar.gz (例如
http ://ftp.ruby-lang.org/pub/ruby/1.9/xxx.tar.gz< /代码>)。但找到的文件只是 tar,而不是 gzip 压缩的。
解决方法是修改 gem 目录中的代码。
我正在寻找知道为什么
ruby-lang.org
中托管的文件未正确进行 gzip 压缩的人。希望能永远解决。这是我的发现的详细描述:
这是解决方法,您必须更改的源代码:
Not sure if your error was happening in
tar_input.rb
orruby_core_source.rb
.Most people solved
tar_input.rb
error, by cleaning up cache files. I solved the one for ruby_core_source.rb:57 'initialize' : not in gzip formatand here is the description and workaround:
The problem was because "sometimes" the ruby source file in the ftp server is not probably tar + gzip. So sometimes the source file is incorrect.
I just gone through the source code, and the code expects a .tar.gz in the ftp server (e.g.
http ://ftp.ruby-lang.org/pub/ruby/1.9/xxx.tar.gz
). But the file found was only tar, but not gzip-ed.The workaround is to modify the code in your gem directory.
I am looking for ppl who knows why the file hosted in
ruby-lang.org
is not properly gzip-ed. Hope that can solve forever.Here is the detail description of my finding:
Here is the workaround, source code that you have to change:
确保您使用正确的宝石来源。
应将
http://rubygems.org/
显示为第一个源。如果缺少,请添加
http://rubygems.org/
作为主要来源。否则,这可能是 RubyGems 索引的暂时问题。另请确保您使用的是最新的 RubyGems(库)版本。
Make sure you are using the right Gem sources.
should display
http://rubygems.org/
as the first source.If missing, add
http://rubygems.org/
as the main source. Otherwise, it might be a temporary issue with RubyGems index.Also make sure you are using the latest RubyGems (library) version.
找出您的 ruby 配置为查找源的位置:
如果它指向 gems.rubyforge.org(首次安装较旧的安装二进制文件时),那么您将指向旧的 Web 服务器,因此当 ruby 尝试获取更新后,它会获取 HTTP 重定向 (302) 作为响应,而不是 GZIP 格式的预期数据。它显然没有配置错误处理程序来检测重定向,因此它只是放弃。
要修复它,您必须更新源列表。首先添加正确的源:
然后删除已弃用的源:
接下来更新您的 ruby 系统:
请注意,更新会验证旧的源 URL 不再有效...
您现在应该能够继续安装,在我的例子中是 rake。
Find out where your ruby is configured to look for sources:
If it is pointed at gems.rubyforge.org (which it is when first installed for older installation binaries) then you’re pointed at the old web server so when ruby tries to get updates it gets an HTTP redirect (302) as a response instead of the expected data in GZIP format. It apparently doesn’t have an error handler configured to detect the redirect so it just gives up.
To fix it you have to update the list of sources. First add the correct source:
Then remove the deprecated one:
Next update your ruby system:
Note that update verifies that the old source URL is no longer valid…
You should now be able to continue your installation, which in my case was rake.
我在使用需要第二阶段身份验证的网络时遇到了这个问题。我忘记在浏览器中进行身份验证,因此任何 Web 请求都被重定向到本地身份验证页面。看来 gem 不会检查它收到的响应是否实际上来自实际的 rubygems.org 服务器(并且它不能单独基于地址查找,除非您使用 ssl 证书)。它不会告诉您它无法到达真正的 rubygems 服务器,而是简单地告诉您它收到的有效负载格式不正确(压缩)。据推测,如果您运行了一个恶意 DNS 服务器,将 rubygems.org 重定向到您自己的服务,您就可以将任何您想要的东西注入到 gem 中......
I ran into this problem when using a network that requires phase 2 authentication. I had forgotten to authenticate in the browser so any web request was redirected to a local authentication page. It would appear that
gem
does not check whether the response it receives is actually from the actual rubygems.org server (and it's can't based on the address lookup alone unless you used an ssl certificate). Rather than telling you it couldn't reach the real rubygems server, it simply tells you the payload it receives is not in the proper format (zipped). Presumable if you ran a malicious DNS server that redirected rubygems.org to your own service, you could inject anything you wanted into the gems....