0

I'm following this guide to get Laravel up and running on my CentOS 7 VM, and have got to step 6- Composer Setup. It says to cd into the 'Homestead' directory, then run vagrant up, followed by vagrant ssh.

Currently, when I run vagrant up, I get an error that says:

C:/.../psych.rb:377:in 'parse': (): did not find expected '-' indicator while parsing a block collection at line 13 column 5 (Psych::SyntaxError)

I came across this question, and the answer seems to suggest that one of the hyphens is too long in the Homestead.yaml file (i.e. it's double hyphen)... I had a look, but that doesn't seem to be the case for me.

My Homestead.yaml file is as follows:

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/code
     to: /home/vagrant/code
     type: "nfs"

sites:
    - map: homestead.test
     to: /home/vagrant/code/public

    - map homestead.app
     to: /home/vagrant/Code/Laravel/public

databases:
    - homestead

Anyone know why I can't run vagrant up? What else can I do to fix this?

Edit

So, I came across this answer, and it seems this issue was not because of a double hyphen anywhere in my yaml file, it was actually because a couple of the lines below the ones starting with a hyphen were tabbed, rather than spaced, and I was also missing the multi-line string indicator |.

After changing the relevant parts of my yaml file to include |, and changing the tabs to spaces, the

did not find expected '-' indicator

error was resolved:

folders:
    - |
     map: ~/code
     to: /home/vagrant/code
     type: "nfs"

sites:
    - |
     map: homestead.test
     to: /home/vagrant/code/public

    - |
     map homestead.app
     to: /home/vagrant/Code/Laravel/public

However, when I now try to run vagrant up, I get another error that says:

C:/Users/.../homestead.rb:213:in `[]=': string not matched (IndexError)

I don't understand what this error is showing, as I can't see the '[]=': characters anywhere in my yaml file... anyone have any ideas?

Noble-Surfer
  • 3,052
  • 11
  • 73
  • 118

1 Answers1

1

You forgot to add :(colon) after map in your yaml file before homestead.app

That's what causing this error. This might be late response but in general When Homestead.ymal has some syntax error, vagrant up will fail with this type of errors.

JD-V
  • 3,336
  • 1
  • 17
  • 20