laravel - vagrant指令執行報錯(內有報錯誤詳情)
滿天的星座
滿天的星座 2017-05-16 16:50:06
0
1
527

事情經過

前一段時間學習laravel在MAC(Sierra 版本10.12)上安裝了一個homestead學習,本來一切正常。就在某次開機後執行homestead up 就報錯了,執行homestead status 也是報錯,而且報錯內容一樣
但是我執行homestead --versionhomestead edit 就沒問題
於是我就想是不是homestead 環境出問題了,於是我執行
vagrant box remove laravel/homestead
想把homestead 刪除重裝。但 vagrant 也報錯了。於是我就想是不是 vagrant 出問題了 於是我想把vagrant 刪了 於是我執行 vagrant destroy還是報錯了

報錯訊息如下

執行homestead指令的時候報錯如下

cottondeMacBook-Pro:bin cotton$ homestead up
/opt/vagrant/embedded/lib/ruby/2.2.0/psych.rb:370:in `parse': (<unknown>): mapping values are not allowed in this context at line 2 column 3 (Psych::SyntaxError)
    from /opt/vagrant/embedded/lib/ruby/2.2.0/psych.rb:370:in `parse_stream'
    from /opt/vagrant/embedded/lib/ruby/2.2.0/psych.rb:318:in `parse'
    from /opt/vagrant/embedded/lib/ruby/2.2.0/psych.rb:245:in `load'
    from /Users/cotton/.composer/vendor/laravel/homestead/Vagrantfile:20: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的時候報錯訊息如下

cottondeMacBook-Pro:bin cotton$ vagrant box remove laravel/homestead
/opt/vagrant/embedded/lib/ruby/2.2.0/psych.rb:370:in `parse': (<unknown>): mapping values are not allowed in this context at line 2 column 3 (Psych::SyntaxError)
    from /opt/vagrant/embedded/lib/ruby/2.2.0/psych.rb:370:in `parse_stream'
    from /opt/vagrant/embedded/lib/ruby/2.2.0/psych.rb:318:in `parse'
    from /opt/vagrant/embedded/lib/ruby/2.2.0/psych.rb:245:in `load'
    from /Users/cotton/.composer/vendor/laravel/homestead/Vagrantfile:20: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:669:in `machine'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/machine_index.rb:441:in `valid?'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/box_remove.rb:82:in `block (2 levels) in call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/box_remove.rb:82:in `each'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/box_remove.rb:82:in `find_all'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/box_remove.rb:82:in `block in call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/box_remove.rb:75:in `each'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/box_remove.rb:75:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/commands/box/command/remove.rb:52:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/commands/box/command/root.rb:61:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/cli.rb:42:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:308:in `cli'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/bin/vagrant:174:in `<main>'

最後我查看了一下指令第一次報錯的地方
/opt/vagrant/embedded/lib/ruby/2.2.0/psych.rb:370:in `parse': (<unknown>) : mapping values are not allowed in this context at line 2 column 3 (Psych::SyntaxError)

def self.parse_stream yaml, filename = nil, &block
368     if block_given?
369       parser = Psych::Parser.new(Handlers::DocumentStream.new(&block))
370       parser.parse yaml, filename
371     else
372       parser = self.parser
373       parser.parse yaml, filename
374       parser.handler.root
375     end

ruby我也不懂,請各位路過大神瞅瞅

#
滿天的星座
滿天的星座

全部回覆(1)
某草草

提示說的意思是你的配置文件有問題,查看一下你的homestead配置文件,是不是配置項附近有什麼空格之類的被刪除了。

最好的就是你diff看一下設定檔和原版的差別。

這個連結你參考一下,錯誤提示的行號不一樣,所以你要去你自己的設定檔裡查。
http://stackoverflow.com/ques...

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!