【问题标题】:Vagrant - berks error when attempting vagrant upVagrant - 尝试 vagrant up 时出现错误
【发布时间】:2017-04-29 14:12:17
【问题描述】:

我正在尝试在我的本地 Mac 机器上创建一个自定义框。由于 VirtualBox 版本的问题,我不得不格式化并重新安装 OSx。我已经安装了 Chef DK、Vagrant 并安装了 berkshelf 插件。当我尝试流浪时,我收到以下错误:

 Bringing machine 'default' up with 'virtualbox' provider...
/opt/vagrant/embedded/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler (LoadError)
    from /opt/vagrant/embedded/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/util/env.rb:1:in `<top (required)>'
    from /Users/cdelgado/.vagrant.d/gems/2.2.5/gems/vagrant-berkshelf-5.1.1/lib/vagrant-berkshelf/helpers.rb:62:in `berks'
    from /Users/cdelgado/.vagrant.d/gems/2.2.5/gems/vagrant-berkshelf-5.1.1/lib/vagrant-berkshelf/action/check.rb:33:in `berkshelf_version_check!'
    from /Users/cdelgado/.vagrant.d/gems/2.2.5/gems/vagrant-berkshelf-5.1.1/lib/vagrant-berkshelf/action/check.rb:16:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/machine.rb:225:in `action_raw'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/machine.rb:200:in `block in action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/environment.rb:567:in `lock'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/machine.rb:186:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/machine.rb:186:in `action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'
    from /opt/vagrant/embedded/gems/gems/logging-2.1.0/lib/logging/diagnostic_context.rb:450:in `call'

我目前的设置是:

Vagrant Version 1.9.0
Chef Development Kit Version: 1.0.3
chef-client version: 12.16.42
delivery version: master (83358fb62c0f711c70ad5a81030a6cae4017f103)
berks version: 5.2.0
kitchen version: 1.13.2

vagrant-berkshelf (5.1.1)
vagrant-omnibus (1.5.0)
vagrant-share (1.1.6)

当我在它运行的配方中禁用 berkshelf 时,但显然依赖项不起作用。

如果我将 berkshelf 插件降级到 5.0.0,我会收到另一个错误:

Bringing machine 'default' up with 'virtualbox' provider...
/Users/cdelgado/.vagrant.d/gems/2.2.5/gems/vagrant-berkshelf-5.0.0/lib/vagrant-berkshelf/helpers.rb:62:in `berks': uninitialized constant VagrantPlugins::Berkshelf::Helpers::Bundler (NameError)
    from /Users/cdelgado/.vagrant.d/gems/2.2.5/gems/vagrant-berkshelf-5.0.0/lib/vagrant-berkshelf/action/check.rb:33:in `berkshelf_version_check!'
    from /Users/cdelgado/.vagrant.d/gems/2.2.5/gems/vagrant-berkshelf-5.0.0/lib/vagrant-berkshelf/action/check.rb:16:in `call'

我已经在谷歌上搜索了好几天,但没有运气,请帮忙。

【问题讨论】:

  • 试试vagrant plugin install bundler?
  • 谢谢,但现在它给出了一个不同的错误:Vagrant failed to initialize at a very early stage: The plugins failed to load properly. The error message given is shown below. Could not locate Gemfile or .bundle/ directory
  • 您可能需要将其从插件清单中删除,您希望保留已安装的 gem,但不要尝试将其作为插件加载。

标签: macos vagrant chef-infra osx-elcapitan berkshelf


【解决方案1】:

与一位同事在谷歌上搜索了很多天后,我们比较了我们的版本并将问题缩小到 Vagrant 版本。我运行的是 1.9.0,他运行的是 1.8.4。由于相同的配方在他的机器上确实有效,我将 Vagrant 降级为他的版本,瞧,它奏效了。我们仍然不知道确切的区别是什么以及为什么会出现这个问题,但现在就可以了。

我希望这对遇到这个问题的人有所帮助。

【讨论】:

    【解决方案2】:

    您需要升级或安装您的 vagrant-share 插件。 运行这个命令:

    vagrant plugin install vagrant-share --plugin-version 1.1.8
    

    根据最新的或想要的版本调整版本。

    如果它不适合你(为我工作),GitHub 上有一个关于这个的问题 here.

    【讨论】:

      猜你喜欢
      • 2014-07-15
      • 2016-09-04
      • 1970-01-01
      • 1970-01-01
      • 2023-03-15
      • 1970-01-01
      • 2016-07-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多