ERROR: While executing gem ... (Zlib::GzipFile::Error) not in gzip format
I assume the ERROR occurs since the web sense at my workplace blocks these downloads.
Solution: I downloaded the required gems: chunky_png, fssm, compass, sass, haml etc.. directly from http://rubygems.org/gems and placed these gems in my local directory.
After this I tried gem install compass
. This first searches your local directory. On finding the required gems, installation takes place. Does not require connection to the ruby website.
Note: Run the command from the path where the gems are located
eg: I have placed the gems in C:\Ruby193\lib\ruby\gems\1.9.1\gems
So I run the following command :
C:\Ruby193\lib\ruby\gems\1.9.1\gems>gem install compass
I get this error when installing a gem: ERROR: While executing gem ... (Zlib::GzipFile::Error)
Something isn't set up properly to fetch the gem from GitHub.
try gem fetch -V
steve@macpro:~$ gem fetch blackbook --version ">= 1.0.7" --source http://github.com/tamoyal/blackbook/tree/master -V
GET 301 Moved Permanently: http://github.com/tamoyal/blackbook/tree/master/specs.4.8.gz
GET 200 OK: http://github.com/tamoyal/blackbook/tree/master/
ERROR: While executing gem ... (Zlib::GzipFile::Error)
not in gzip format
You're getting the "not in gzip format" error because gem
can't fetch specs.4.8.gz
. GitHub returns a 301 redirect back to your project home page, which of course isn't what it wants and isn't gzipped.
Sorry I can't help you further, but I haven't build a gem, much less on GitHub.
Zlib::GzipFile::Error: not in gzip format
Your str
contains Base64 encoded data. However, since Zlib::GzipReader
doesn't decode the data on its own but expects the raw binary gzip data, it fails.
You can manually decode the data before creating your StringIO
object though:
require 'base64'
require 'stringio'
require 'zlib'
str = 'H4sIAAAAAAAA/y2NwQrDIBAFfyXstUbWNWrir5RSrEoQUi2JOZSQf6+EHt8wzDtgKd7VVPIG9n7AMwWwYhj1MBkkwtEwcN7vq/NfsAo5MnhFt6Y8g71WcDXW9I5ggVCYHqlH0xE12RJ1N5SIwGBpJ3UPTVOKa41IssGS5z+Vhhs1SdHo9okxXPXzcf4AY45Ve6EAAAA='
raw = Base64.decode64(str)
input = StringIO.new(raw)
puts Zlib::GzipReader.new(input).read
# => {"locations":[{"_id":1486497022087,"accuracy":50.0,"bearing":0.0,"datetime":"2017-02-07 22:50:22 +0300","latitude":55.660023,"longitude":37.759313,"speed":0.0}]}
The website you linked to also describes this behavior (emphasis mine):
This simple online text compression tool is compressing a plain text and decompressing compressed base64 string with gzip, bzip2 and deflate algorithms
ERROR: While executing gem with local gem
I fixed this by changing my DNS as detailed in this question
Rubygems blocked by Norton DNS
I ran namebench and have switched to OpenDNS-2.
strange bundler error: tar_input.rb:49:in `initialize': not in gzip format (Zlib::GzipFile::Error) on bundle pack
to answer my own question:
the fix was to delete all the contents from
vendor/cache
after that it worked.
clearly a bundler bug.
Related Topics
How to Display the Current Date in "Mm/Dd/Yyyy" Format in Rails
How to Remove a Node with Nokogiri
Difference Between Integer(Value) and Value.To_I
How to Read a File from Bottom to Top in Ruby
Ruby Forgets Local Variables During a While Loop
Ruby Backslash to Continue String on a New Line
How to Access Nested Elements of a Hash with a Single String Key
Getting Uninitialized Constant Error When Trying to Run Tests
Notification of Object Destruction in Ruby
Language in a Sandbox in Rails
Ruby | Find a Way to Find an Exception on the Same Word to Capitalize
Ruby Capitalize Every Word First Letter
Ruby Modules - Included Do End Block
How to Integrate Paypal with Ruby on Rails