不是 gzip 格式错误

发布于 2024-09-06 11:05:45 字数 421 浏览 2 评论 0原文

在安装任何 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

粉红×色少女 2024-09-13 11:05:45

看起来 ruby​​gems.org(或您定义的任何 gem 源)已关闭。

Looks like rubygems.org (or any gem source you have defined) is down.

橘虞初梦 2024-09-13 11:05:45

不确定您的错误是否发生在 tar_input.rbruby_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 压缩的人。希望能永远解决。

这是我的发现的详细描述:

http://ru05team.blogspot.com/2011/08/solving-workaround-initialize-not-in.html

这是解决方法,您必须更改的源代码:

https://gist.github.com/1183048

Not sure if your error was happening in tar_input.rb or ruby_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 format
and 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:

http://ru05team.blogspot.com/2011/08/solving-workaround-initialize-not-in.html

Here is the workaround, source code that you have to change:

https://gist.github.com/1183048
信仰 2024-09-13 11:05:45

确保您使用正确的宝石来源。

$ gem sources

应将 http://rubygems.org/ 显示为第一个源。

如果缺少,请添加 http://rubygems.org/ 作为主要来源。否则,这可能是 RubyGems 索引的暂时问题。

另请确保您使用的是最新的 RubyGems(库)版本。

$ gem update --system

Make sure you are using the right Gem sources.

$ 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.

$ gem update --system
清晰传感 2024-09-13 11:05:45

找出您的 ruby​​ 配置为查找源的位置:

C:\>gem sources
*** CURRENT SOURCES ***

http://gems.rubyforge.org/

如果它指向 gems.rubyforge.org(首次安装较旧的安装二进制文件时),那么您将指向旧的 Web 服务器,因此当 ruby​​ 尝试获取更新后,它会获取 HTTP 重定向 (302) 作为响应,而不是 GZIP 格式的预期数据。它显然没有配置错误处理程序来检测重定向,因此它只是放弃。

要修复它,您必须更新源列表。首先添加正确的源:

C:\>gem sources -a http://rubygems.org/
http://rubygems.org/ added to sources

然后删除已弃用的源:

C:\>gem sources -r http://gems.rubyforge.org/
http://gems.rubyforge.org/ removed from sources

C:\>gem sources
*** CURRENT SOURCES ***

http://rubygems.org/

接下来更新您的 ruby​​ 系统:

C:\>gem update --system
Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-1.3.7
:0:Warning: Gem::SourceIndex#search support for String patterns is deprecated
Updating RubyGems to 1.3.7
Installing RubyGems 1.3.7
RubyGems 1.3.7 installed

=== 1.3.7 / 2010-05-13

NOTE:

http://rubygems.org is now the default source for downloading gems.

You may have sources set via ~/.gemrc, so you should replace
http://gems.rubyforge.org with http://rubygems.org

http://gems.rubyforge.org will continue to work for the forseeable future.
...

请注意,更新会验证旧的源 URL 不再有效...

您现在应该能够继续安装,在我的例子中是 rake。

Find out where your ruby is configured to look for sources:

C:\>gem sources
*** CURRENT SOURCES ***

http://gems.rubyforge.org/

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:

C:\>gem sources -a http://rubygems.org/
http://rubygems.org/ added to sources

Then remove the deprecated one:

C:\>gem sources -r http://gems.rubyforge.org/
http://gems.rubyforge.org/ removed from sources

C:\>gem sources
*** CURRENT SOURCES ***

http://rubygems.org/

Next update your ruby system:

C:\>gem update --system
Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-1.3.7
:0:Warning: Gem::SourceIndex#search support for String patterns is deprecated
Updating RubyGems to 1.3.7
Installing RubyGems 1.3.7
RubyGems 1.3.7 installed

=== 1.3.7 / 2010-05-13

NOTE:

http://rubygems.org is now the default source for downloading gems.

You may have sources set via ~/.gemrc, so you should replace
http://gems.rubyforge.org with http://rubygems.org

http://gems.rubyforge.org will continue to work for the forseeable future.
...

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.

江心雾 2024-09-13 11:05:45

我在使用需要第二阶段身份验证的网络时遇到了这个问题。我忘记在浏览器中进行身份验证,因此任何 Web 请求都被重定向到本地身份验证页面。看来 gem 不会检查它收到的响应是否实际上来自实际的 ruby​​gems.org 服务器(并且它不能单独基于地址查找,除非您使用 ssl 证书)。它不会告诉您它无法到达真正的 ruby​​gems 服务器,而是简单地告诉您它收到的有效负载格式不正确(压缩)。据推测,如果您运行了一个恶意 DNS 服务器,将 ruby​​gems.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....

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文