Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Laravel 4 Basics Getting Started with Laravel Laravel Folder Structure

Cloud Edwards
Cloud Edwards
8,132 Points

<SOLVED>You have arrived is working, but my Projects folder is empty.

I have set it all up on a windows 8 machine, and everything is working fine. Inside my vagrant box, I have the laravel-basics folder, with the laravel build installed inside.

But when I go to Homestead/Projects, there is nothing there.

I am expecting that there should be a laravel-basics folder (or what ever name it is) inside my Projects folder. This should be synced to the vagrant box. But it isn't.

I have checked my Homesrtead.yaml file a lot, to no avail.

Please help. here is my .yaml file


ip: "10.0.10.10" memory: 2048 cpus: 1

authorize: c:/Users/Cloud/.ssh/id_rsa.pub

keys: - c:/Users/Cloud/.ssh/id_rsa

folders: - map: c:/Users/Cloud/Homestead/Projects to: /home/Sites

sites: - map: test.app to: /home/vagrant/Sites/laravel-test/public

databases: - homestead

variables: - key: APP_ENV value: local

3 Answers

that might have to do with a small mistake in your "folders" property, where you currently link to /home/Sites on your Vagrant box. When defining the "sites" property you link to /home/vagrant/Sites/.... - you see the difference in the defining the vagrant root directory?

So in your case it should be like that for the folders and the sites property:

folders: 
- map: c:/Users/Cloud/Homestead/Projects 
  to: /home/vagrant/Sites

sites: 
- map: test.app 
  to: /home/vagrant/Sites/laravel-test/public
Cloud Edwards
Cloud Edwards
8,132 Points

Thanks for the answer!

I figured out what happened. You were right, it WAS something to do with the folder mapping. But you can't see it in the code I posted.

Here's what happened: When I first installed laravel/homestead. with

vagrant box add laravel/homestead 

The Homstead.yaml file was pointing to a different directory.

So that is where the synced clone was put when I ran.

 bash init.sh

Then later I changed the yaml file to point to where it is now. But the clone was not in the Projects folder. it was somewhere else. I moved the clone to the Projects folder, but that somehow got rid of the laravel/homestead build in vagrant.

What I ended up doing, was deleting the laravel/homestead from Vagrant, and deleted the "homestead" Virtual Machine. I also deleted my Homestead folder and the .homestead folder (it has the .yaml file in it)

Then I put a new laravel/homestead box into vagrant.

vagrant box add laravel/homestead

and cloned a new Homestead folder,

git clone https://github.com/laravel/homestead.git Homestead 

created a fresh .yaml file, making sure I knew where it was being sent.

bash init.sh 

Then I ran

vagrant up

And it worked perfectly.

For those experiencing this problem and to save them a little time, @manuelpenazola is correct, you need to change the folder you're mapping to, however, you don't have to start over from square one and delete homestead after you do this. Simply shut down your virtual machine with the "vagrant halt" command and restart it with the "vagrant up" command. It'll find your new path after that. All you have to do after that is make a new Laravel project and you're good to go!

Justin Roberts
Justin Roberts
14,583 Points

I'm having this same problem, everything is working fine other than Projects folder is empty. I think all of my mappings are correct. I tried restarting vagrant or whatever using halt and up. I've tried re-creating the project and nothing seems to work.

Justin Roberts
Justin Roberts
14,583 Points

Never mind, I figured it out.