【问题标题】:Vagrant: undefined method 'box_url='流浪者:未定义的方法'box_url ='
【发布时间】:2014-06-06 16:22:10
【问题描述】:

我正在尝试根据 Jeffery Way 教程设置一个基本的 Vagrant 实例。当我运行 vagrant up 时出现此错误:

../Vagrantfile:9:in `block in <top (required)>': undefined method `box_url=' for "precise32":String (NoMethodError)
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/config/v2/loader.rb:37:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/config/v2/loader.rb:37:in `load'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/config/loader.rb:103:in `block (2 levels) in load'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/config/loader.rb:97:in `each'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/config/loader.rb:97:in `block in load'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/config/loader.rb:94:in `each'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/config/loader.rb:94:in `load'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/vagrantfile.rb:28:in `initialize'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:574:in `new'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:574:in `vagrantfile'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:359:in `host'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:168:in `block in action_runner'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:33:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:33:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:346:in `hook'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:556:in `unload'
    from /Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/bin/vagrant:169:in `ensure in <main>'
    from /Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/bin/vagrant:169:in `<main>'

到目前为止,我唯一做的就是运行 vagrant init 和 将“Vagrantfile”修改为如下所示:

# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "precise32"
  config.vm.box.box_url = "http://files.vagrantup.com/precise32.box"

end

Google 没有提供任何关于“未定义方法 'box_url='”的信息......我们非常感谢任何帮助。

【问题讨论】:

    标签: virtual-machine vagrant vagrantfile


    【解决方案1】:

    您使用了错误的语法!应该是这样的

    config.vm.box = "precise32"
    config.vm.box_url = "http://files.vagrantup.com/precise32.box"
    

    【讨论】:

      猜你喜欢
      • 2016-07-31
      • 1970-01-01
      • 2022-01-26
      • 2014-07-04
      • 2015-02-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多