Homestead虚拟机启动错误

9
/Users/shaddeler/Developer/run/Homestead/scripts/homestead.rb:169:in `+': no implicit conversion of nil into String (TypeError)
    from /Users/shaddeler/Developer/run/Homestead/scripts/homestead.rb:169:in `block (2 levels) in configure'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/kernel_v2/config/vm_provisioner.rb:72:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/kernel_v2/config/vm_provisioner.rb:72:in `add_config'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/kernel_v2/config/vm.rb:324:in `provision'
    from /Users/shaddeler/Developer/run/Homestead/scripts/homestead.rb:168:in `block in configure'
    from /Users/shaddeler/Developer/run/Homestead/scripts/homestead.rb:157:in `each'
    from /Users/shaddeler/Developer/run/Homestead/scripts/homestead.rb:157:in `configure'
    from /Users/shaddeler/Developer/run/Homestead/Vagrantfile:30:in `block in <top (required)>'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/v2/loader.rb:37:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/v2/loader.rb:37:in `load'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/loader.rb:113:in `block (2 levels) in load'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/loader.rb:107:in `each'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/loader.rb:107:in `block in load'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/loader.rb:104:in `each'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/loader.rb:104:in `load'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/vagrantfile.rb:28:in `initialize'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:746:in `new'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:746:in `vagrantfile'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:492:in `host'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:214:in `block in action_runner'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:33:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:33:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:479:in `hook'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:728:in `unload'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/bin/vagrant:177:in `ensure in <main>'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/bin/vagrant:177:in `<main>'

我在使用 vagrant up 命令时遇到了这个错误。

尝试重新初始化Homestead。 - Frederic Henri
我在Homestead.yaml文件中找到了问题。我重写了源文件夹路径。谢谢。 - Goragio Haddeler
2个回答

19

我也遇到了这个问题。与其说是缩进不正确,不如说我在我的Homestead.yaml文件中意外地添加了另一个连字符(-)。

例如,这是不正确的内容:

- map: testing.khc.my
- to: /home/vagrant/code/testing/public

正确的答案是这个:

- map: testing.khc.my
  to: /home/vagrant/code/testing/public

希望这能帮助大家,未来更加美好。

这正是我的文件出了问题的原因。很好地发现了。 - iAmBentley

5

我也遇到了这个错误,真的很烦人。问题的根源是Homestead.yaml文件中的缩进错误。检查一下你是使用空格还是制表符。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接