19

i am getting a strange bundler error when running

bundle pack

with bundler 0.9.12

any ideas? (see pastie for a better formatted code: http://pastie.org/881328 )

/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `initialize': not in gzip format (Zlib::GzipFile::Error)
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `new'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `initialize'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb:63:in `each'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb:54:in `loop'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb:54:in `each'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:32:in `initialize'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:17:in `new'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:17:in `open'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package.rb:55:in `open'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/format.rb:63:in `from_io'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/format.rb:51:in `from_file_by_path'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/format.rb:50:in `open'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/format.rb:50:in `from_file_by_path'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/source.rb:115:in `specs'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/source.rb:114:in `each'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/source.rb:114:in `specs'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:32:in `from_cached_specs'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:23:in `application_cached_gems'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:15:in `cached_gems'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:5:in `build'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:14:in `cached_gems'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/environment.rb:15:in `index'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:5:in `build'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/environment.rb:13:in `index'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/runtime.rb:86:in `specs'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/runtime.rb:130:in `details'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/runtime.rb:119:in `write_yml_lock'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/runtime.rb:65:in `lock'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/cli.rb:89:in `lock'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/cli.rb:131:in `package'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/task.rb:33:in `send'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/task.rb:33:in `run'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/invocation.rb:109
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/invocation.rb:116:in `call'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/invocation.rb:116:in `invoke'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor.rb:137:in `start'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/base.rb:378:in `start'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor.rb:124:in `start'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/bin/bundle:11
  from /opt/REE/bin/bundle:19:in `load'
  from /opt/REE/bin/bundle:19
Jon Seigel
  • 12,251
  • 8
  • 58
  • 92
z3cko
  • 3,054
  • 8
  • 40
  • 59

11 Answers11

21

I was having similar problem with bundle upate (bundler 1.0). I am using rvm with gemset for my application.

Solution was to remove:

~/.rvm/gems/ree-1.8.7-2010.02@gemset-name/cache

morgoth
  • 1,357
  • 1
  • 13
  • 21
  • Ugh, didn't work for me. I was really hoping it would. Still researching here… – Clinton Jan 06 '11 at 15:38
  • This worked for me. It's worth noting that after doing this, I had to run bundle install on all of my apps and gems using bundler. – jbgo Jan 07 '11 at 18:47
  • For any Googlers coming this way: it can also mean your gem source is down or inaccessible. I hit this problem when trying to pull gems down from my company's repo without being connected to VPN. – Matt Greer May 28 '13 at 16:10
14

to answer my own question:

the fix was to delete all the contents from

vendor/cache

after that it worked.

clearly a bundler bug.

z3cko
  • 3,054
  • 8
  • 40
  • 59
7

Allegedly, the original issue is fixed with Bundler 1.0.x, but I still had the same error message (using 1.0.3). I removed all cache folders, including in RVM directories, as outlined in the other answers here -- no dice.

It turns out you'll also get this error if Bundler can't resolve one of your sources (i.e., those returned by $ gem sources). Even if you list multiple sources, it will ping all of them, and if any source is bad, it will crash with this nondescript 'initialize': not in gzip format error.

As described in this ticket, that can be because of something like an inaccessible VPM or local network source, but I actually ran into the problem due to my company's firewall blocking rubygems.org.

Just submitting this answer as another possible solution to clear up this vague error message.

T.J. Schuck
  • 3,645
  • 2
  • 19
  • 20
4

just happened to me with bundler 0.9.26 and rails3 beta4. launched

bundle package

now it works. but if I remove vendor/cache the problem persists.

Andrea Pavoni
  • 5,311
  • 2
  • 29
  • 44
2

Had the same thing, removed /bundler_gems/cache

Jim Soho
  • 2,018
  • 2
  • 21
  • 25
2

Even though I'm running Bundler 1.0.0, I still hit this error. bundle install didn't work, but running bundle package did.

shedd
  • 4,198
  • 4
  • 33
  • 42
1

rm -rf vendor/cache

bundle package

bundle install

bundle lock

It's a bit annoying... I don't know why I can't do bundle install --relock

Aaron Gibralter
  • 4,773
  • 3
  • 35
  • 50
1

If you're using Capistrano with Bundler's require 'bundler/capistrano', the cache directory is at shared/bundle/ruby/1.8/cache.

Jason Weathered
  • 7,762
  • 2
  • 41
  • 37
0

All traces of this error went away when I upgraded to Bundler 1.0.x.

Aaron Gibralter
  • 4,773
  • 3
  • 35
  • 50
0

I've solved this issue in a rails 3.1 app by deleting the archived gem files:

$ bundle -v
Bundler version 1.0.17
$ rm -f vendor/bundle/ruby/1.8/cache/*.gem
olistik
  • 784
  • 5
  • 13
0

I ran into this problem when deploying, but didn't want to remove vendor/cache from git.

Instead, I ended up doing this:

# deploy.rb
namespace :bundle do
  desc "Removes vendor/cache when NO_GEM_CACHE=1 is set. Resolves Zlib::GzipFile::Error (not in gzip format)."
  task :remove_cache do
    run "rm -fr #{release_path}/vendor/cache" if ENV['NO_GEM_CACHE'] == '1'
  end
end
before :'bundle:install', :'bundle:remove_cache'

Whenever this error crops up simply:

cap deploy NO_GEM_CACHE=1
Zubin
  • 9,422
  • 7
  • 48
  • 52