Learning laravel some time ago, I installed a homestead on MAC (Sierra version 10.12), and everything was normal. Just after a certain boot, I executed homestead up
and an error was reported. Executing homestead status
also reported an error, and the error content was the same
But I executed homestead --version
, homestead edit
No problem
So I wondered if there was something wrong with the homestead environment, so I executed vagrant box remove laravel/homestead
Thought Delete homestead and reinstall it. But vagrant also reported an error. So I wondered if there was something wrong with vagrant, so I wanted to delete vagrant, so I executed vagrant destroy
and still got an error
When executing the homestead command, the following error is reported
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>'
The error message reported when executing vagrant is as follows
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>'
Finally, I checked where the command reported the first error
/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
I don’t understand ruby either, please take a look at it
某草草2017-05-16 16:52:06
The prompt means there is a problem with your configuration file. Check your homestead configuration file to see if there are any spaces or the like near the configuration items that have been deleted.
The best thing is to use diff to see the difference between the configuration file and the original version.
Please refer to this link. The line number of the error message is different, so you have to check it in your own configuration file.
http://stackoverflow.com/ques...