无法安装vagrant-berkshelf插件

时间:2014-01-13 16:43:44

标签: vagrant berkshelf

我已更新到Vagrant 1.4.3并尝试安装vagrant-berkshelf插件。我收到以下错误:

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

我尝试使用系统和Vagrant特定的红宝石手动安装minitar。系统ruby安装得很好。当我手动将它安装到Vagrant ruby​​中时,我得到了以下内容:

$ 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

但是,我仍然得到完全相同的错误。我试图从vagrant-berkshelf github repo手动安装Gemfile中的每个gem,但仍然无法安装。

3 个答案:

答案 0 :(得分:4)

我在https://github.com/berkshelf/vagrant-berkshelf/issues/140询问并收到了以下答案。

这与流浪汉厨师图书管理员的依赖性发生冲突。解决方案是使用以下命令手动安装minitar:

$ /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

我错过的是安装目录。

答案 1 :(得分:2)

从5天前开始Vagrant Berkshelf has been retired

使用Vagrant的Chef here is a good article

请注意该页面上的“注释”:

  

注意:截至1月28日星期二,Vagrantfile和vagrant-bershelf   插件正在退役您可以使用本系列的第3部分中介绍的Test Kitchen及其.kitchen.yml来完成本文中提到的所有内容(vagrant up,vagrant provision等)。考虑跳到第3部分,现在就开始使用Test Kitchen。本文仅为历史目的而保留。

请遵循this link并使用Test Kitchen而不是Vagrant Berkshelf。我还没有尝试过,但我和你在同一条船上 - 希望让Solo主厨与Vagrant合作。

答案 2 :(得分:1)

到目前为止,测试厨房设置无法完成所有工作,例如多机器设置。您可以使用本地Berkshelf安装替换vagrant-berkshelf,并使用vagrant-triggers在&#34; vagrant up&#34;或&#34;流浪儿条款&#34;。

我已经写了short blog post

基本上归结为:

  • 安装Ruby / Berkshelf
  • 安装vagrant-triggers Vagrant插件
  • 对目录中的供应商食谱使用vagrant-trigger
  • 运行Vagrant chef-solo provisioner

以下Vagrantfile代码段将使用vagrant-triggers插件来调用本地安装的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

这将执行Berkshelf在&#34; cookbook&#34;中安装所需的烹饪书。目录,默认情况下安装在您的流浪汉VM中并由Vagrant chef-solo provisioner使用。