Homestead not mapping files

Viewed 581

I'm new to Laravel and I'm trying to get Laravel homestead to work, but no matter what I do the files on the VM will not map to my hard drive. I've tried on Windows and Mac thinking it might have been a windows problem, but it won't work on my Mac either. Also, when I try halting the machine and re provisioning, it deletes the contents of the project on the VM, I have no idea why this happens

Here is my homestead.yaml file (mac), on Windows it would be the same but with C://pathtofolder instead of the ~

Thanks in advance

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

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

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

databases:
    - homestead

features:
    - mariadb: false
    - ohmyzsh: false
    - webdriver: false

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

Edit - the issue is that I was making the project in the vagrant SSH, not on my disk. It maps from the disk to the VM, not the other way around, it seems.

1 Answers

Although you stated you did, are you sure you executed these commands:

vagrant halt
vagrant provision
vagrant up

As far as mapping goes I would do this:

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

And start a new project by this:

cd /home/vagrant
laravel new test
Related