Laravel homestead not mapping my code folder - laravel

I am trying to get homestead to work after following the instructions here
I have Virtualbox 5.0.6 and Vagrant 1.7.4 on windows 8. The machine boots up fine(ish) the only problem is that my mapped folder is not present on the vm, meaning when I vagrant ssh, the directory /home/vagrant/ is empty, there is no Code directory inside of it. This is a screenshot of the machine booting(it should keep going and saying mapping the folders and stuff):
And this is the content of my Homestead.yaml file
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: C:\Users\Khalid\.ssh\id_rsa.pub
keys:
- C:\Users\Khalid\.ssh\id_rsa
folders:
- map: D:\work
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 93000
# to: 9300
# - send: 7777
# to: 777
# protocol: udp
Could someone please help, Thanks
EDIT: The full output of vagrant up --debug can be found here

sstarlight was on the right track. It's a path name issue. I'm on windows 8 with homestead too and you need to use the forward slashes even in your windows paths.
The below should do the trick!
authorize: C:/Users/Khalid/.ssh/id_rsa.pub
keys:
- C:/Users/Khalid/.ssh/id_rsa
folders:
- map: D:/work
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
I would add to this that you should run the provisioning as per the other answer after you make the change by bringing your homestead up with the --provision flag set.

Make sure and re-verify that the path for the keys and authorize are correct and run vagrant up --provision to re-provision the homestead setup again

Try change
D:\work to D:/work/

Related

Windows 10 Hosts file not working Laravel Homestead

I am trying to get windows to redirect homestead.localhost to the site i have setup in Laravel Homestead. But its not letting me access the page. i can access the site i setup by going to 192.168.10.10 but going to http://homestead.localhost in my browser brings up:
ERR_CONNECTION_REFUSED
My windows host file, the only line in it, has
192.168.10.10 homestead.localhost
And here is my Homestead.yaml:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: C:/Users/jarro/Documents/Sites
to: /home/vagrant/Sites
sites:
- map: homestead.localhost
to: /home/vagrant/Sites/homestead
databases:
- homestead
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
So the question is, why is my windows 10 host not working.
I have did the following:
Cleared IP Config, Restarted computer, deleted and created a new vagrant, and reloaded the vagrant.
What am i missing?
sites:
- map: homestead.localhost
to: /home/vagrant/Sites/homestead
You have to map your site to the "public" folder of your Laravel Project! Something like:
to: /home/vagrant/Sites/myLaravelProject/public
Homestead doesn't have any index.php which could be referenced.
So after about a week of giving up, i decided to go back and try again. Found a post on Laracasts:
https://laracasts.com/discuss/channels/general-discussion/homestead-windows-10-need-to-specify-port-8000
All you have to do to fix what i am having done is add :8000 on the url and the site loads. Its not working on port 80 for some reason. I am gonna go fix this now so i can rest in peace.
:D
This is an old question but in the Hosts file I find it much easier to just use:
127.0.0.1 myapp.local
It works everytime. I have always had minor problems with using 192.168.10.10

Running Vagrant in Homestead. "Shell provisioner `args` must be a string or array"

I tried to use Homestead for Laravel 5 in Windows 10, but it's not working.
I first installed VirtualBox and later Vagrant.
Then I executed the command
vagrant box add laravel/homestead
After that I cloned the Homestead repository into Users folder.
git clone https://github.com/laravel/homestead.git ~/Homestead
Next I executed the file "init.bat", located in Homestead cloned folder.
In the book "Laravel:Up and Running" is write that the script will:
"This will place Homestead’s primary configuration file,
Homestead.yaml, in a new ~/.homestead directory."
But a hidden Homestead directory is not created.
Despite that, I continued the process and modified the Homestead.yaml file located at "Users/sshann/Homestead" to:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: C:\Users\sshann\.ssh\id_rsa.pub
keys:
- C:\Users\sshann\.ssh\id_rsa
folders:
- map: D:\Project\laravel
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
And to finish I started vagrant in the directory "Users/sshann/Homestead" with
vagrant up
But then this error showed in CMD
Bringing machine 'homestead-7' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:
shell provisioner:
* Shell provisioner `args` must be a string or array.
I though that I might have messed up the Homestead.yaml, so I undid the changes, restore the file to its default content and re-run the last command again, but the same error showed again, so I suppose that the problem is not with the file.
I have the following directories:
C:\Users\sshann\Homestead
C:\Users\sshann\.VirtualBox
C:\Users\sshann\.vagrant.d
I searched for solutions, but none solved.
Do someone know what might be my problem? Thank you in advance.

Laravel Homestead - No input file specified?

I am trying to install a Homestead VM for Laravel development on Debian Linux 8 with Vagrant 1.8.4 and VirtualBox 5.0.24 r108355.
Following the official documentation, I have installed Homestead and configured it in Homestead.yaml in the following way:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Code/dev.todoparrot.com
to: /home/vagrant/Code
sites:
- map: dev.todoparrot.com
to: /home/vagrant/Code/dev.todoparrot.com/public
databases:
- homestead
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
To test it with a sample file, I have created an index.php in /home/user/Code/dev.todoparrot.com/public/ on my local machine that echos a string:
<?php echo "Hello from Homestead!"; ?>
I have also added dev.todoparrot.com to /etc/hosts:
127.0.0.1 localhost
127.0.1.1 debian
192.168.10.10 dev.todoparrot.com
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Within the Homestead folder of my local machine, the VM starts both via vagrant up and vagrant up --provision, but when I visit the domain http://dev.todoparrot.com/ in the browser, I get the following error:
No input file specified.
Any idea what could be wrong?
No input file specified
It says that you don't have any file in
/home/vagrant/Code/dev.todoparrot.com/public
For now, your Vagrant path is
/home/vagrant/Code/dev.todoparrot.com/
And you looking for dev.todoparrot.com/public in dev.todoparrot.com
That's your issue
You need change
folders:
- map: ~/Code/dev.todoparrot.com
to: /home/vagrant/Code
to:
folders:
- map: ~/Code
to: /home/vagrant/Code
It will emulate all folders in Code to /home/vagrant/Code/
Run vagrant up --provision after every update of Homestead.yaml
And in the future, you need to change/add only
sites:
- map: project-name.app
to: /home/vagrant/Code/ProjectName/public
Use vagrant ssh to check your current folders structure inside Code
If you already tried
vagrant up --provision
and still you getting 'No input file specified' error, try to run
vagrant reload --provision
reload vagrant box works for me.

Homestead virtualbox error, the host path of the shared folder is missing: ~/Code

Iam trying to use homestead laravel, seems some issue that am feeling strange.
root#seetha-H81M-S:/home# homestead up
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
homestead.yaml
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/Homestead
sites:
- map: nal.app
to: /home/seetha/Homestead/nal/public
There is a folder named Homestead in /home/Homestead , still seems not working.
I have find similar questions in stack-overflow but nothing seems working for me.
Can anyone help me to solve this issue.
Thanks in advance.
OS Ubuntu 14.04
I had the same problem and fixed it by bash init.sh
Run the bash init.sh command from the Homestead directory to create the Homestead.yaml configuration file. The Homestead.yaml file will be placed in the ~/.homestead hidden directory.
If you are changing Homestead.yaml again, you have to re-run bash init.sh again. It will ask for overwrite, say yes.
You have this issue when your folders are not properly mapped.
This is how to map your folders in vagrant Homestead.yaml
folders:
- map: ~/Code
to: /home/vagrant/Code
~/Code means /home/yourUsername/Code must exist in your host computer.
The code folder will house all your Laravel apps.
Example you could have the following apps in Code folder which are on your host
/home/vagrant/Code/laravelapp
/home/vagrant/Code/laravelapp2
Homestead.yaml may now look like this
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: /wamp/www
to: /home/vagrant/Code
sites:
- map: laravel.dev
to: /home/vagrant/Code/laravelapp/public
- map: laravel.dev2
to: /home/vagrant/Code/laravelapp2/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
# blackfire:
# - id: foo
# token: bar

Homestead multiple sites not working

I'm a newbie on laravel, and running homestead I had one site before added another one did not work. I destroyed homestead and started once again and added two sites in Sites section in homestead.yaml file the bluprint of my homestead.yaml file is below
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/laravel
to: /home/vagrant/laravel
sites:
- map: project1.dev
to: /home/vagrant/laravel/project1/public
- map: project2.dev
to: /home/vagrant/laravel/project2/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 93000
# to: 9300
# - send: 7777
# to: 777
# protocol: udp
I added those two sites in my /etc/hosts file as well blueprint is below
#laravel maps
192.168.10.10 project1.dev
192.168.10.10 project2.dev
but when i run project1.dev or project2.dev they both show me the content of project1.dev files
Any Idea?
You can't use tabs on the file, use only spaces to indentation and this will solve the problem.
Now, only run
vagrant reload --provision
To reload the configuration file.
Note: If you use vagrant destroy and vagrant up, you lose everything on your VM.
I think I needed to the vagrant provision command to restart the server and register the changes that I have made
so once you finished with homestead.yaml and /etc/hosts file run this
vagrant provision
Like how here says, you can install Homestead directly into your project, require it using this composer require laravel/homestead --dev at root directory of each project you have. Now by make command you can generate Vagrantfile and Homestead.yaml file into your project's root directory.
Mac/Linux:
php vendor/bin/homestead make
Windows:
vendor\bin\homestead make
On each project root you will have a Homestead.yaml file to edit:
Project-A
ip: "192.168.10.10"
...
folders:
- map: "~/Code/projecta"
to: "/home/vagrant/projecta"
sites:
- map: project.a
to: "/home/vagrant/projecta/public"
Project-B
ip: "192.168.10.11"
...
folders:
- map: "~/Code/projectb"
to: "/home/vagrant/projectb"
sites:
- map: project.b
to: "/home/vagrant/projectb/public"
Add this to /etc/hosts:
192.168.10.10 project.a
192.168.10.11 project.b
Then you have to cd to each project's root and vagrant up.
Now if you vagrant ssh from each project, you will have that project in your VM environment.
Of course there is a Homestead.yaml file inside ~/.homestead, but vagrant goes for the .yaml file that is located inside project root first. In my case, the ~/.homestead/Homestead.yaml file is ignored.

Resources