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

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

Related

Running 'vagrant up' generates an error

ERROR MESSAGE
I've been following the steps here
After editing, my homestead.yaml now looks like:
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: C:/Users/User/.ssh/id_rsa.pub
keys:
C:/Users/User/.ssh/id_rsa
folders:
- map: D:/homestead/dev.todoparrot.com
to: /home/vagrant/Code
sites:
- map: dev.todoparrot.com
to: /home/vagrant/Code/dev.todoparrot.com/public
databases:
- homestead
I generated the key with Git Gui and it put it into C:/Users/User/.ssh/ automatically. I left it as is.
I created the folders: map: directory manually (D:/homestead/dev.todoparrot.com). It's empty.
Then, I ran Power Shell inside the Homestead folder (C:/Users/User/) (the main Homestead folder with homestead.yaml and other files inside).
I typed "vagrant up" into Power Shell and got this error (link at the very top). What am I doing wrong?
Under keys, you're missing a - before the path:
keys:
- C:/Users/User/.ssh/id_rsa

vagrant homestead directory missing

when I run command ls it doesn't show any file.
My homestead.yaml file:
which directory should i look in to check.
There's seems to be some issues with homestead lately for windows folk.
to make sure you can access your files in the VM just add the following in your Vagrantfile
config.vm.synced_folder "C:/Users/<User>/projects", "/home/vagrant/Code"
Try to provision the Vagrant VM
vagrant reload --provision
I paste my Homestead.yaml file. You are in Windows, so try to put your complete local folder (C:\Users\my_user\development in my machine) and provision the machine another time
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: C:\Users\my_user\development
to: /home/vagrant/Code
sites:
- map: my_site.app
to: /home/vagrant/Code/web/my_site/public
databases:
- my_database

Laravel and Vagrant: Don't have /home/vagrant folder

I've successfully created a laravel app with the $ laravel new blog command on my Ubuntu 16.04. All app files are located at the ~/Code folder.
Here's my Homestead.yaml file:
---
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
sites:
- map: devbase.app
to: /home/vagrant/Code/blog/public
databases:
- homestead
The problem is I don't have this /home/vagrant folder on my computer. And, of course, the blog app source files are not shared to this folder.
Do I have to manually create this folder? And how to make the ~/Code folder share files with it then?
Or there occurred a problem while installing VirtualBox, Vagrant or Homestead?
What I have to do to make it work properly?
You don't have to have /home/vagrant on your machine, it's the folder inside vagrant box (Homestead). Run vagrant ssh (password is vagrant) command to connect to the VM and you'll find /home/vagrant directory there.

Unable to find code folder in the vagrant home directory

I am trying to setup vagrant on my windows OS. I have watched some tutorial about that.
According to those tutorial, I should be able to map some folder from windows to the vagrant machine . I have configured homestead.yaml file with below info :
authorize: ~/.ssh/id_rsa.pub
keys:
- /Users/Fakhreddin/.ssh/id_rsa
folders:
- map: Users/Fakhreddin/code
to: /home/vagrant/code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
But when i check my vagrant home directory, there is no folder with code name
I have tried to create it manually, But it doesn't work.
What's wrong with it and how to solve?
add this line to Vagrantfile
config.vm.synced_folder "Users/Fakhreddin/code", "/home/vagrant/code"
The folder name is Code, with uppercase, the Linux machine is case sensitive.
check VagrantFile ,find this:
config.vm.synced_folder "D:/Project", "/home/vagrant/Code"

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

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.
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)
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
In Windows case I used this:
- map: e:/GIT/PHP/mathmaps/Code
to: /home/vagrant/Code
P.S. GIT is my workspace folder
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.
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

Resources