`inflate&#39 ;:缓冲区错误(Zlib :: BufError)执行`bundle install`

时间:2014-05-01 10:40:25

标签: ruby-on-rails-3 bundler

我正在尝试bundle install,但我收到以下错误:

Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/home/nish/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/util.rb:40:in `inflate': buffer error (Zlib::BufError)
    from /home/nish/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/util.rb:40:in `inflate'
    from /home/nish/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems.rb:536:in `inflate'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:93:in `fetch_spec'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/remote_specification.rb:46:in `_remote_specification'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/remote_specification.rb:51:in `method_missing'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/index.rb:95:in `block (2 levels) in unmet_dependency_names'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/index.rb:94:in `map'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/index.rb:94:in `block in unmet_dependency_names'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/index.rb:93:in `map'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/index.rb:93:in `unmet_dependency_names'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:240:in `remote_specs'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:163:in `fetch_specs'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:67:in `specs'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/definition.rb:192:in `block (2 levels) in index'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:in `each'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:in `block in index'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/index.rb:9:in `build'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/definition.rb:185:in `index'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/definition.rb:179:in `resolve'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/definition.rb:109:in `resolve_remotely!'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/installer.rb:83:in `run'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/installer.rb:14:in `install'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/cli.rb:247:in `install'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `run'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in `dispatch'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/bin/bundle:20:in `block in <top (required)>'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/bin/bundle:20:in `<top (required)>'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/bin/bundle:23:in `load'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/bin/bundle:23:in `<main>'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@voylla/bin/ruby_noexec_wrapper:14:in `eval'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@voylla/bin/ruby_noexec_wrapper:14:in `<main>'

我尝试了以下内容:

gem update --sysytem

但我仍然得到同样的错误。请有人帮忙!感谢

1 个答案:

答案 0 :(得分:1)

<强>解

找出导致问题的原因。在我们正在使用geminabox的情况下,并且因为什么原因,railties-4.1.6.gemspec.rz被破坏了。不知道它是怎么发生的但事实确实如此。所以我们所做的就是删除了铁路-4.1.6

rm shared/gems/proxy/quick/Marshal.4.8/railties-4.1.6.gemspec.rz

之后系统捆绑正常。如果您遇到同样的问题,您将不得不找到一种方法来观看网络呼叫并查看它正在停止的GET事件。

EXTRA READING 不修复错误只会在某些情况下抑制它

这之所以有效,是因为新版本使用了不同版本的铁路。它只给人的印象就是解决了这个问题。

以下是此错误的一些额外信息。但它并不能完全解释为什么会这样。 cannot install ruby gems - zlib error

现在他们已经在v2.0.0-p451删除或修复了这段代码,但ruby-2.1.0还没有合并我还没回过去的补丁,抛出所有代码并检查每个版本,但这里是你怎么检查。

What you are looking for就是这个档案。 lib/rubygems/util.rb中有一个名为inflate的方法,此方法负责解压缩gem文件。然而,它存在某种错误,它被调用在无法解压缩的东西上。

这是一个稳定的版本,你找不到lib/rubygems/util.rb v2.0.0-p481。所以这很难找到,但通过查看源代码,你可以找出哪些有这个bug,哪些没有。

如果您使用的是rvm,请使用此命令安装正确的版本

rvm install ruby-2.0.0-p481

要查看所有知道ruby版本的可用,您可以在下面运行此命令。

$ rvm list known

[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p547]
[ruby-]2.0.0-p451
[ruby-]2.0.0[-p481]
[ruby-]2.1.1
[ruby-]2.1[.2]
[ruby-]2.1-head
ruby-head
...

通过更改为该补丁版本,您应该没问题。我也使用ruby-2.0.0-p247发现了这个错误。

上面的代码表明你也有错误。然而,这很奇怪,因为github回购说它直到2013年11月18日才被引入。

https://github.com/ruby/ruby/commit/a7fa4d5d9aab150ad4b0c3f3217fe444df69f527

无论如何,我知道这里有很多信息,但这个bug很棘手。它接缝只会影响某些版本的ruby,但由于代码的组织,有时很难说它是否在你的版本中。最好的方法是检查是否有util.rb文件,如果有,则更改版本。