开发者

not in gzip format error

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 i开发者_StackOverflow社区n gzip format

Please help me out how to reslove this


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


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


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


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜