13

I'd like to use laravel homestead for my development machine and installed virtualbox and vagrant successfully, but when I run vagrant up I get this error:

Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The host path of the shared folder is missing: ~/Code

The Homestead.yaml file looks like this:

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

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Code
      to: /home/vagrant/Code

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

databases:
    - homestead

variables:
    - key: APP_ENV
      value: local

These are the default settings, but they don't really work for my machine - I don't even have /home/vagrant folder nor do I have ~/Code anywhere where I can see. I'm using ubuntu 12.04 - can you please point me to how I should configure my settings because by the official documentation I'm kind of lost.

Xeen
  • 6,955
  • 16
  • 60
  • 111
  • 1
    Did you try creating a folder `Code` in your root directory? Of your local machine, that is, not in the virtual one. Homestead is complaining that it can't find that directory, so it can't connect `/home/vagrant/Code` within the virtual machine to it. – Joel Hinz Feb 17 '15 at 09:10

5 Answers5

19

Inside the homestead directory, you have to run the command bash init.sh.

This will generate the Homestead.yaml file (and after.sh and aliases) inside your home directory (~).

If you are changing Homestead.yaml again, you have to re-run bash init.sh again. It will ask for overwrite, say yes.

(and as mentioned in other answers, be sure that the directory for folders: - map: exists)

trogne
  • 3,402
  • 3
  • 33
  • 50
  • 2
    running bash init.sh again overridden the values back to default...in my case i just edited and saved the file and this was it. – Junaid May 13 '16 at 15:26
15

In your Ubuntu machine you have to let Homestead know where your actual code is located. Example:

If you code is located in a seperate partition called WORKSPACE you need to type the following:

    - map: /Volumes/WORKSPACE/YourProject
      to: /home/vagrant/Code
adis
  • 5,901
  • 7
  • 51
  • 71
  • 1
    I followed your answer, and I still get the error `* The host path of the shared folder is missing: ~/Applications/MAMP/htdocs/` – code-8 Apr 16 '15 at 13:51
  • 2
    I configure mine like this : `folders: - map: ~/Applications/MAMP/htdocs/ to: /home/vagrant/Code sites: - map: homestead.app to: /home/vagrant//Applications/MAMP/htdocs/aveniros/Laravel/public` – code-8 Apr 16 '15 at 13:51
  • 1
    how I can know, where is my code located? i.e. how to know what wil be the value of `map:` – partho Sep 10 '15 at 16:32
  • 2
    value of `map` is you **local** code folder. How can I be that you not know where your code is? – adis Sep 11 '15 at 06:43
3

In Windows case I used this:
- map: e:/GIT/PHP/mathmaps/Code
to: /home/vagrant/Code

P.S. GIT is my workspace folder

Maxwellt
  • 126
  • 5
1

running bash init.sh a second time will prompt to overwrite the initial setup, this will also output the directory path you require to edit the correct Homestead.yaml file.

Harry Bosh
  • 3,611
  • 2
  • 36
  • 34
-1

The map: attribute has to be set to the location to where you want to keep your code. For example, I will be saving my code in a folder called code within the Homestead folder therefore, map is:

folders:
    - map: ~/Development/Homestead/Code
      to: /home/vagrant/Code

Where 'Development' is simply a folder in my home directory where I keep all my code

Gabriel
  • 157
  • 3
  • 11