19

运行时出现奇怪的捆绑程序错误

bundle pack

使用捆绑器 0.9.12

有任何想法吗?(有关格式更好的代码,请参见 Pastie: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
4

11 回答 11

21

我在使用 bundle upate(bundle 1.0)时遇到了类似的问题。我在我的应用程序中使用带有 gemset 的 rvm。

解决方案是删除:

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

于 2010-09-01T11:19:22.090 回答
14

回答我自己的问题:

解决方法是删除所有内容

vendor/cache

之后它起作用了。

显然是捆绑程序错误。

于 2010-03-22T18:38:49.287 回答
7

据称,Bundler 1.0.x 修复了原始问题,但我仍然收到相同的错误消息(使用 1.0.3)。我删除了所有cache文件夹,包括 RVM 目录中的文件夹,如此处其他答案中所述 - 没有骰子。

事实证明,如果 Bundler 无法解析您的某个源(即,由 . 返回的源),您也会$ gem sources收到此错误。即使您列出了多个来源,它也会对所有来源进行 ping 操作,并且如果任何'initialize': not in gzip format来源有问题,它也会因这个无法描述的错误而崩溃。

如此票证中所述,这可能是由于无法访问的 VPM 或本地网络源之类的原因,但由于我公司的防火墙阻止了 ruby​​gems.org,我实际上遇到了问题。

只需将此答案作为另一种可能的解决方案提交,以清除此模糊的错误消息。

于 2010-12-01T19:32:48.577 回答
4

刚刚发生在我的捆绑器 0.9.26 和 rails3 beta4 上。推出

bundle package

现在它可以工作了。但如果我删除供应商/缓存问题仍然存在。

于 2010-06-16T14:51:27.657 回答
2

有同样的事情,删除 /bundler_gems/cache

于 2010-04-22T01:00:30.163 回答
2

即使我正在运行 Bundler 1.0.0,我仍然遇到此错误。 bundle install没有用,但跑步可以bundle package

于 2010-10-01T08:04:52.520 回答
1

rm -rf vendor/cache

bundle package

bundle install

bundle lock

有点烦。。。不知道为什么做不到bundle install --relock

于 2010-06-28T00:07:36.843 回答
1

如果您将 Capistrano 与 Bundler 一起使用require 'bundler/capistrano',则缓存目录位于shared/bundle/ruby/1.8/cache.

于 2010-09-03T05:01:35.127 回答
0

当我升级到 Bundler 1.0.x 时,这个错误的所有痕迹都消失了。

于 2010-09-07T15:41:00.007 回答
0

我通过删除存档的 gem 文件在 rails 3.1 应用程序中解决了这个问题:

$ bundle -v
Bundler version 1.0.17
$ rm -f vendor/bundle/ruby/1.8/cache/*.gem
于 2011-09-05T09:59:18.387 回答
0

我在部署时遇到了这个问题,但不想vendor/cache从 git 中删除。

相反,我最终这样做了:

# 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'

每当出现此错误时:

cap deploy NO_GEM_CACHE=1
于 2012-03-15T21:19:16.967 回答