Vagrant up throws parse error

时间:2016-06-12 11:34:29

标签: vagrant yaml hyper-v vagrantfile

我尝试使用hyper作为提供程序运行vagrant,遵循此guide。 但是,当我跑出去' vagrant up'我收到以下错误:

    $ vagrant up
C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/psych.rb:370:in `parse': (<unknown>): found a tab character that violate intendation while scanning a plain scalar at line 21 column 7 (Psych::SyntaxError)
        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/psych.rb:370:in `parse_stream'
        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/psych.rb:318:in `parse'
        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/psych.rb:245:in `load'
        from E:/www/Homestead/Vagrantfile:20:in `block in <top (required)>'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/config/v2/loader.rb:37:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/config/v2/loader.rb:37:in `load'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/config/loader.rb:113:in `block (2 levels) in load'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/config/loader.rb:107:in `each'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/config/loader.rb:107:in `block in load'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/config/loader.rb:104:in `each'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/config/loader.rb:104:in `load'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/vagrantfile.rb:28:in `initialize'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/environment.rb:740:in `new'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/environment.rb:740:in `vagrantfile'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/environment.rb:486:in `host'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/environment.rb:208:in `block in action_runner'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/action/runner.rb:33:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/action/runner.rb:33:in `run'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/environment.rb:473:in `hook'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/lib/vagrant/environment.rb:722:in `unload'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/bin/vagrant:177:in `ensure in <main>'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.3/bin/vagrant:177:in `<main>'

E:/ www / Homestead / Vagrantfile:20:在`block in&#39;让我有理由相信这就是发生解析错误的地方。

来自vagrantfile的第20行加载了homestead.yaml:

        Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))

这是我的homestead.yaml。 我已使用http://www.yamllint.com/检查其有效性,并说明它有效。

    --- 
authorize: C:\Users\xxx\.sshid_rsa.pub
box: johnpbloch/homestead
cpus: 1
databases: 
  - homestead
folders: 
  - 
    map: ~/Code
    to: /home/vagrant/Code
ip: "192.168.10.10"
keys: 
  - ~/.ssh/id_rsa
memory: 2048
provider: virtualbox
sites: 
  - 
    map: homestead.app
    to: /home/vagrant/Code/Laravel/public

为什么我收到此错误,如何解决此错误?

1 个答案:

答案 0 :(得分:6)

当您看到此错误时,您应该查看homestead.yaml文件。有空间或进入额外。

 - 
    map: ~/Code

应该是:

- map: ~/Code

- 
    map: homestead.app

应该是:

 - map: homestead.app