3

在 Mac 10.8.5 上运行 VMWare Fusion 6。尝试安装 vagrant-vmware-fusion 插件并收到此错误。我认为这是一个 Ruby 问题,但我不太确定,因为我没有使用 Ruby 的经验。任何帮助将非常感激。

vagrant plugin install vagrant-vmware-fusion
Installing the 'vagrant-vmware-fusion' plugin. This can take a few minutes...
/Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/package/tar_reader/entry.rb:127:in `read': undefined method `size' for nil:NilClass (NoMethodError)
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/package/tar_reader/entry.rb:126:in `read'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/package/tar_reader/entry.rb:126:in `read'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/format.rb:73:in `block (2 levels) in from_io'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:64:in `block in each'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `loop'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `each'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/package/tar_input.rb:138:in `block (2 levels) in each'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:28:in `new'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/package/tar_input.rb:137:in `block in each'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:64:in `block in each'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `loop'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `each'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/package/tar_input.rb:132:in `each'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/format.rb:66:in `block in from_io'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/package/tar_input.rb:22:in `open'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/package.rb:44:in `open'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/format.rb:62:in `from_io'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/format.rb:46:in `block in from_file_by_path'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/format.rb:45:in `open'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/format.rb:45:in `from_file_by_path'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/installer.rb:119:in `format'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/installer.rb:129:in `spec'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/installer.rb:386:in `ensure_required_ruby_version_met'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/installer.rb:156:in `install'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/dependency_installer.rb:297:in `block in install'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/dependency_installer.rb:270:in `each'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/dependency_installer.rb:270:in `each_with_index'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/dependency_installer.rb:270:in `install'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/commands/plugin/action/install_gem.rb:49:in `block in call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/commands/plugin/gem_helper.rb:42:in `block in with_environment'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/user_interaction.rb:40:in `use_ui'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/commands/plugin/gem_helper.rb:41:in `with_environment'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/commands/plugin/action/install_gem.rb:39:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/commands/plugin/action/bundler_check.rb:20:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builder.rb:116:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in `block in run'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/util/busy.rb:19:in `busy'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in `run'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/commands/plugin/command/base.rb:17:in `action'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/commands/plugin/command/install.rb:27:in `execute'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/commands/plugin/command/root.rb:52:in `execute'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/cli.rb:38:in `execute'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/environment.rb:478:in `cli'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/bin/vagrant:96:in `<top (required)>'
from /Applications/Vagrant/bin/../embedded/gems/bin/vagrant:23:in `load'
from /Applications/Vagrant/bin/../embedded/gems/bin/vagrant:23:in `<main>'
4

1 回答 1

0

正确的答案是上面说的其他人:gem包坏了,你需要从互联网上获取一个合适的包,然后安装它。是类似的问题,gem 作者建议只更新 gem:

该错误似乎发生在 gem 包的“解压缩”期间。这似乎表明它试图解压的包文件已损坏。鉴于 ruby​​gems 中的 untar 源代码在 2 年内没有更改,并且对其他人都适用,因此问题是特定于您的安装的。

在您的情况下,所有其他 gem 都可以正常工作,因此只有该文件已损坏。我认为在下载/解压缩过程中出现了损坏文件的问题。它可能已将此损坏的文件存储在某处。您可能需要弄清楚它在哪里,以便将其删除。之后,rubygems 应该尝试再次下载它,之后安装应该按预期工作

因此,正如人们建议的那样,删除所有缓存的包:

$ find -name "package.gem" -exec rm -f {} \;

然后在您拥有良好互联网线路的地方下载 gem:

$ gem fetch package.gem

将 gem 复制到源项目文件夹中,然后安装它:

$ gem install ./package.gem

如果已成功安装,请将其复制到捆绑程序缓存(在我的情况下,它位于.bundle文件夹中),因此:

$ mv ./package.gem ./.bundle/cache/

然后发出bundle

$ bundle
于 2015-07-18T18:10:50.400 回答