gpt4 book ai didi

ruby - nil :NilClass in gem install 的未定义方法大小

转载 作者:数据小太阳 更新时间:2023-10-29 08:12:35 25 4
gpt4 key购买 nike

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

最佳答案

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

The error seems to occur during the "untarring" of the gem package. That seems to indicate that the package file it tries to untar is corrupt. Given that the untar source code hasn't changed in 2 years in rubygems, and it works fine for everybody else, the problem is specific to your install.

In your case, all other gems work fine, so only this file is corrupt. I assume something went wrong during the download/unzip that corrupted the file. It probably has stored this corrupted file somewhere. You may need to figure out where it is so you can delete it. Afterwards, rubygems should attempt to download it again, after which the install should work as expected

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

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

然后在网络状况良好的地方下载 gem:

$ gem fetch package.gem

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

$ gem install ./package.gem

如果安装成功,将它复制到 bundler 缓存(在我的例子中它位于 .bundle 文件夹中),所以:

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

然后发布bundle:

$ bundle

关于ruby - nil :NilClass in gem install 的未定义方法大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19438079/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com