Cannot install vagrant-berkshelf plugin

帅比萌擦擦* 提交于 2019-12-13 01:34:43

问题


I've updated to Vagrant 1.4.3 and am attempting to install the vagrant-berkshelf plugin. I'm getting the following error:

$ vagrant plugin install vagrant-berkshelf
Installing the 'vagrant-berkshelf' plugin. This can take a few minutes...
/opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/installer.rb:184:in `check_executable_overwrite': "minitar" from minitar conflicts with installed executable from archive-tar-minitar (Gem::InstallError)
from /opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/installer.rb:384:in `block in generate_bin'
from /opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/installer.rb:371:in `each'
from /opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/installer.rb:371:in `generate_bin'
from /opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/installer.rb:231:in `install'
from /opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/dependency_installer.rb:379:in `block in install'
from /opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/dependency_installer.rb:339:in `each'
from /opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/dependency_installer.rb:339:in `each_with_index'
from /opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/dependency_installer.rb:339:in `install'
from /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/plugins/commands/plugin/action/install_gem.rb:65:in `block in call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/plugins/commands/plugin/gem_helper.rb:42:in `block in with_environment'
from /opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/user_interaction.rb:40:in `use_ui'
from /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/plugins/commands/plugin/gem_helper.rb:41:in `with_environment'
from /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/plugins/commands/plugin/action/install_gem.rb:52:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/plugins/commands/plugin/action/bundler_check.rb:20:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/builder.rb:116:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/runner.rb:69:in `block in run'
from /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/util/busy.rb:19:in `busy'
from /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/runner.rb:69:in `run'
from /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/plugins/commands/plugin/command/base.rb:17:in `action'
from /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/plugins/commands/plugin/command/install.rb:27:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/plugins/commands/plugin/command/root.rb:56:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/cli.rb:38:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/environment.rb:484:in `cli'
from /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/bin/vagrant:127:in `<top (required)>'
from /opt/vagrant/bin/../embedded/gems/bin/vagrant:23:in `load'
from /opt/vagrant/bin/../embedded/gems/bin/vagrant:23:in `<main>'

I tried to manually install minitar with both the system and Vagrant-specific rubies. System ruby installed it just fine. When I manually installed it into the Vagrant ruby, I got the following:

$ sudo /opt/vagrant/embedded/bin/gem install minitar
Fetching: minitar-0.5.4.gem (100%)
minitar's executable "minitar" conflicts with archive-tar-minitar
Overwrite the executable? [yN]  y
Successfully installed minitar-0.5.4
Parsing documentation for minitar-0.5.4
Installing ri documentation for minitar-0.5.4
1 gem installed

But, I still get the exact same error. I've tried to manually install every gem in the Gemfile from the vagrant-berkshelf github repo and still cannot install.


回答1:


I asked in https://github.com/berkshelf/vagrant-berkshelf/issues/140 and received the following answer.

It was a conflict with a dependency in vagrant-chef-librarian. The solution was to manually install minitar with the following command:

$ /opt/vagrant/embedded/bin/gem install minitar --install-dir ~/.vagrant.d/gems
minitar's executable "minitar" conflicts with archive-tar-minitar
Overwrite the executable? [yN]  y
Successfully installed minitar-0.5.4
Parsing documentation for minitar-0.5.4
Installing ri documentation for minitar-0.5.4
1 gem installed

The bit I'd missed was the install-dir.




回答2:


Apparently Vagrant Berkshelf has been retired as of 5 days ago.

To use Chef with Vagrant, here is a good article.

Note the "Note" on that page:

NOTE: As of Tuesday, January 28th the Vagrantfile and the vagrant-bershelf plugin are being retired You can do everything mentioned in this article (vagrant up, vagrant provision, etc.) with Test Kitchen and its .kitchen.yml covered in Part 3 of this series. Consider skipping ahead to Part 3 and just start using Test Kitchen now. This article will be retained just for historical purposes.

So follow this link and use Test Kitchen instead of Vagrant Berkshelf. I have not tried this yet but I am in the same boat as you -- looking to get Chef Solo working with Vagrant.




回答3:


Up to now, the Test Kitchen setup cannot do everything e.g. multi machine setups. You can replace vagrant-berkshelf with a local Berkshelf installation and using vagrant-triggers to do cookbook vendoring on "vagrant up" or "vagrant provision".

I have written a short blog post about it.

Basically it boils down to:

  • Install Ruby/Berkshelf
  • Install vagrant-triggers Vagrant plug-in
  • Use vagrant-trigger to vendor cookbooks in a directory
  • Run the Vagrant chef-solo provisioner

The following Vagrantfile snippet will use the vagrant-triggers plug-in to call a locally installed Berkshelf:

  [:up, :provision].each do |cmd|
    config.trigger.before cmd, :stdout => true do
      info 'Cleaning cookbook directory'
      run "rm -rf #{cookbooks_path}"
      info 'Installing cookbook dependencies with berkshelf'
      run "berks vendor #{cookbooks_path}"
    end
  end

This will execute Berkshelf to install the needed cookbooks in the "cookbook" directory, which is mounted in your vagrant VM and used by the Vagrant chef-solo provisioner by default.



来源:https://stackoverflow.com/questions/21096659/cannot-install-vagrant-berkshelf-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!