流浪者:未定义的方法' box_url ='

时间:2014-06-06 16:22:11

标签: virtual-machine vagrant vagrantfile

我正在尝试根据Jeffery Way教程设置一个基本的Vagrant实例。当我运行流浪汉时,我收到了这个错误:

../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和 修改了&#39; Vagrantfile&#39;看起来像这样:

# -*- 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

谷歌没有对未定义的方法提出任何建议&#39; box_url =&#39;&#34; ...非常感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

您使用的语法错误!它需要像这样

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