'A Vagrant environment or target machine is required
I am trying to set up homestead. I have tried to add new custom domain but I forgot that I have to run the command vagrant provision and I got an error, so I have decided to uninstall Vagrant VirtualBox and start from scratch but I have realy messed the things up.
Now I have installed VirtualBox, Vagrant. I have cloned the repository of homestead on my home directory. I filled the Homestead.yaml but when I start with vagrant up I get this error
A Vagrant environment or target machine is required to run this
command. Run vagrant init to create a new Vagrant environment. Or,
get an ID of a target machine from vagrant global-status to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.
Also I have tried to require homestead through composer but I`am still getting the same error.
When I try with vagrant init a new box is created and when I start vagrant up I am not in the homestead box but in the one that I last created.
I am really confused and I don`t know what I am missing. Any help will be appreciated.
edit.
Also when I try with homestead up, the virtual machine is running and I am able to connect through ssh but when I type custom domains I get "No input file specified."
update:
In the ~/.homestead directory I have executed vagrant init laravel/homestead and now I can start the the machine and to connect through ssh but I can`t go to a registered custom domain - the page is not available.
Update 2:
Also I just checked and on the homestead server my Code folder is empty. In the Homestead.yamlfile I have folders
- map: ~/Code
to: /home/vagrant/Code
All my projects are there in the local folder and I have no idea why they are not on vagrant.
Solution 1:[1]
99% you're in wrong directory. Make sure that the directory includes Vagrantfile.
Solution 2:[2]
Can you run vagrant global-status to see if there is already a Vagrant server running? Then you can use vagrant up [server-id] to get into the existing one.
Solution 3:[3]
As someone said earlier, you could be in the wrong directory. Actually going to the right directory containing the 'Vagrantfile' was all that solved my problem.
Solution 4:[4]
Also when I try with homestead up, the virtual machine is running and I am able to connect through ssh but when I type custom domains I get "No input file specified."
Did you add your custom domains to your Homestead.yaml file in the sites section and run `vagrant provision
Solution 5:[5]
Before trying anything else make sure you are in the correct directory. I mean, vagrantfile must be present in the directory. I was able to fix it by
- One vagrant server was already running in my case. vagrant global-status helped me to see it.
- Then I used vagrant up [server-id] to get into the existing one.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | S1awek |
| Solution 2 | Jeff |
| Solution 3 | aye decoder |
| Solution 4 | Frederic Henri |
| Solution 5 | Raw_Wish |
