'Problem in adding phpmyadmin in vagrant and homestead

I tried to install phpmyadmin a couple of times but failed. I was constantly changing homestead.yaml, but vagrant is constantly throwing me an error when I try command vagrant reload --provision. Vagrant works for me with an ordinary laravl project.

homestead.yaml

 ---

folders:
  - map: E:\projects
    to: /home/vagrant/code
  - map: E:\projects\phpmyadmin
    to: /home/vagrant/code/phpmyadmin

sites:
  - map: dev-cms.com
    to: /home/vagrant/code/new-blog/public
  - map: phpmyadmin.test
      to: /home/vagrant/code/new-blog/phpmyadmin

databases:
  - homestead


Vagrant error when type vagrant reload --provision

C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/psych.rb:456:in `parse': (<unknown>): mapping values are not allowed in this context at line 22 column 9 (Psych::SyntaxError)
        from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/psych.rb:456:in `parse_stream'
        from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/psych.rb:390:in `parse'
        from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0/psych.rb:277:in `load'
        from C:/Users/User/Homestead/Vagrantfile:29:in `block in <top (required)>'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/config/v2/loader.rb:37:in `load'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/config/loader.rb:126:in `block (2 levels) in load'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/config/loader.rb:119:in `each'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/config/loader.rb:119:in `block in load'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/config/loader.rb:116:in `each'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/config/loader.rb:116:in `load'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/vagrantfile.rb:29:in `initialize'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/environment.rb:793:in `new'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/environment.rb:793:in `vagrantfile'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/environment.rb:974:in `process_configured_plugins'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/environment.rb:178:in `initialize'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/bin/vagrant:194:in `new'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/bin/vagrant:194:in `<main>'

Host windows file

192.168.56.56 dev-cms.com
127.0.0.1 phpmyadmin.test


Solution 1:[1]

the yaml as it is provided in the question has some indentation issue, you can review yaml lint to validate your yaml file.

The following one will be valid

--- 

databases: 
  - homestead
folders: 
  - map: "E:\\projects"
    to: /home/vagrant/code
  - map: "E:\\projects\\phpmyadmin"
    to: /home/vagrant/code/phpmyadmin
sites: 
  - map: dev-cms.com
    to: /home/vagrant/code/new-blog/public
  - map: phpmyadmin.test
    to: /home/vagrant/code/new-blog/phpmyadmin

note:

  • additional space on 1st line
  • wrong indentation for the 2nd site to: /home/vagrant/code/new-blog/phpmyadmin

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1