4

so I'm trying to get into Laravel and this is my first time using Vagrant, so here's my problem:

I've worked through the Laravel Homestead introduction and set up my development box, everything appears to be working and I did see the Laravel default app.When wrapping up the day I've stopped the local vagrant using vagrant halt and tried starting it again using vagrant up as before and then I'm receiving the

"( ! ) Fatal error: Uncaught RuntimeException: A facade root has not been set. in /home/vagrant/code/laravel/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 234"

Message when trying to reach my Laravel app. Since this also happens for a completely new project, I assume that I'm missing something very basic, could anyone tell me how to handle Vagrant so that I can still reach my project after restarting the virtual machine?

I did not write any code except initially creating the Laravel application via composer, the error does not pop up because I'm trying to use something and am doing it wrong. I am using the default state of a new application and it pops up.

Kendoflow
  • 41
  • 1
  • 3
  • Possible duplicate of [Laravel 5.6 - Uncaught RuntimeException: A facade root has not been set](https://stackoverflow.com/questions/49818102/laravel-5-6-uncaught-runtimeexception-a-facade-root-has-not-been-set) – Naing Lin Aung Jun 05 '19 at 08:18
  • I am afraid that is not the case. I did not try to use anything, I in fact did not write any own code after using composer to create the project. Do you have an idea what might be wrong? – Kendoflow Jun 05 '19 at 09:22
  • I am facing exactly the same problem with new laravel 5.8 instalation. Just like Kendoflow, I've setup Vagrant and new Laravel installation and I'm getting this error. Please help! – Tjodalv Jun 05 '19 at 15:37

4 Answers4

9

Ran into this issue because the default laravel/homestead box installed via vagrant is set to v8.0.0-alpha2 which seems to be very broken. You will need to reinstall the box and delete the current box.

Reference: https://github.com/laravel/homestead/issues/1178

cd ~/Homestead
vagrant destroy
vagrant box remove laravel/homestead --box-version=8.0.0-alpha2
vagrant box add laravel/homestead --box-version=7.2.1
vagrant up
Cody Moorhouse
  • 227
  • 2
  • 5
  • You're welcome! it sounds like the latest Homestead version blocks the alpha version from being used haha, hopefully no one else runs into this problem – Cody Moorhouse Jun 06 '19 at 15:45
  • Hey @CodyMoorhouse. I did all your steps but if i run "vagrant up" it tries do download the latest 8.0.0 version from amazon.aws . how can i force it to install thze 7.2 box i just downloaded? – Lukas Jul 17 '19 at 18:31
  • 1
    I found the answer: you need to add "version: 7.2.1" to your Homestead.yaml – Lukas Jul 17 '19 at 18:37
  • This aeems to still be a problem with 8.0.0 stable. Take off the -alpha2 in the third line – Mike Morris - MBXSW Jul 21 '19 at 04:17
  • 2
    I love Laravel, but there is a lot of this kind of stuff in the Laravel ecosystem. I keep seeing bugs and issues like this that should have been easily caught IMO and should never have been shipped out to production... – William Jul 22 '19 at 06:26
1

as the same of the answer top of me by @Cody Moorhouse

but in my case did,t work till i did this :

before run the box up i added version:7.2.1 to homstead.ymal

ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
version: 7.2.1
authorize: ~/.ssh/id_rsa.pub

and i edited the compser.json and added

"extra_data":{  
        "box":{  
           "name":"laravel/homestead",
           "provider":"virtualbox",
           "version":"dev-release"
        }
     },

to force vagrant to use the version 7.2.1

then on homestead dirctory i lunched compsoer update

after that vagrant up work perfect .

0

Upgrading VirtualBox to v6 from v5 fixed this issue for me. I'm on OSX 10.15 Catalina.

I didn't have to adjust the version of my homestead box after upgrading VirtualBox.

Upgrading was recommended as a fix from this github issue: https://github.com/laravel/homestead/issues/1178

zeterain
  • 1,140
  • 1
  • 10
  • 15
0

Homestead periodically issues "alpha" / "beta" boxes for testing, which may interfere with the vagrant box add command you run during homestead setup. If you are having issues you may run the vagrant up command and the correct box will be downloaded when Vagrant attempts to start the virtual machine.

So skip the step vagrant box add laravel/homestead

Try doing the following:

vagrant destroy
vagrant up

Vagrant will download and choose the correct laravel/homestead version for you.

Information source

agotfrid
  • 507
  • 5
  • 7