A VirtualBox machine with the name 'homestead' already exists

前端 未结 30 4011
旧巷少年郎
旧巷少年郎 2020-12-02 04:58

Since homestead 2.0 homestead laravel has not been working

I don\'t know why \'homestead init\' creates a Homestead.yaml file in mydirectory/.homestead and not in

30条回答
  •  Happy的楠姐
    2020-12-02 05:34

    The Vagrant relies on VirtualBox (if that's the default provider) so it checks for existing environment first before provisioning your VM.

    It is executing the following command:

    VBoxManage list vms
    

    and when it finds the VM with the same hostname, so it'll fail.

    You can debug it by:

    vagrant --debug up
    

    to find out the exact reason.


    Solution

    If you're planning to use multiple VMs in different folders, then you need to change your config.vm.hostname (possibly config.vm.provider(name) as well) in your Vagrantfile to make it unique. Or simply remove it, so Vagrant will assign a different name for each VM.

    If that's not the case, simply shutdown and unregister previous VM which conflicts by running:

    VBoxManage controlvm NAMEOFVM poweroff
    VBoxManage unregistervm NAMEOFVM --delete
    

    and re-run your vagrant up.

    If it fails on directory rename (because you missed --delete), then rename or remove the destination folder, for example:

    rm -fr ~/"VirtualBox VMs/NAMEOFVM"
    

    and re-try again.


    This problem may be related to: GitHub issue #2969 - vagrant up not detecting a previously run VM

提交回复
热议问题