简体   繁体   English

Laravel 5.8:宅基地重启后未设置外观根

[英]Laravel 5.8: A facade root has not been set after homestead restart

so I'm trying to get into Laravel and this is my first time using Vagrant, so here's my problem:所以我试图进入 Laravel,这是我第一次使用 Vagrant,所以这是我的问题:

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我已经完成了Laravel Homestead 介绍并设置了我的开发框,一切似乎都在工作,我确实看到了 Laravel 默认应用程序。当我使用vagrant halt停止本地 vagrant 并尝试再次启动它的那一天结束时像以前一样使用vagrant up然后我收到了

"( ! ) 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" “(!)致命错误:未捕获的运行时异常:尚未设置外观根。在第 234 行的 /home/vagrant/code/laravel/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php 中”

Message when trying to reach my Laravel app.尝试访问我的 Laravel 应用时的消息。 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?由于这也发生在一个全新的项目中,我假设我错过了一些非常基本的东西,谁能告诉我如何处理 Vagrant 以便在重新启动虚拟机后我仍然可以访问我的项目?

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.除了最初通过 Composer 创建 Laravel 应用程序之外,我没有编写任何代码,错误不会弹出,因为我正在尝试使用某些东西并且做错了。 I am using the default state of a new application and it pops up.我正在使用新应用程序的默认状态,它会弹出。

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.遇到这个问题是因为通过 vagrant 安装的默认laravel/homestead box 设置为v8.0.0-alpha2 ,这似乎很laravel/homestead You will need to reinstall the box and delete the current box.您将需要重新安装盒子并删除当前的盒子。

Reference: https://github.com/laravel/homestead/issues/1178参考: 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

as the same of the answer top of me by @Cody Moorhouse与@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在运行该框之前,我将 version:7.2.1 添加到 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我编辑了 compser.json 并添加了

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

to force vagrant to use the version 7.2.1强制 vagrant 使用 7.2.1 版本

then on homestead dirctory i lunched compsoer update然后在 homestead dirctory 我午餐了 compsoer update

after that vagrant up work perfect .之后那流浪汉工作就完美了。

Upgrading VirtualBox to v6 from v5 fixed this issue for me.将 VirtualBox 从 v5 升级到 v6 为我解决了这个问题。 I'm on OSX 10.15 Catalina.我在 OSX 10.15 Catalina 上。

I didn't have to adjust the version of my homestead box after upgrading VirtualBox.升级 VirtualBox 后,我不必调整 Homestead Box 的版本。

Upgrading was recommended as a fix from this github issue: https://github.com/laravel/homestead/issues/1178建议升级作为此 github 问题的修复程序: https : //github.com/laravel/homestead/issues/1178

Homestead periodically issues "alpha" / "beta" boxes for testing, which may interfere with the vagrant box add command you run during homestead setup. Homestead 会定期发布“alpha”/“beta”框进行测试,这可能会干扰您在 homestead 设置期间运行的 vagrant box add 命令。 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.如果您遇到问题,您可以运行 vagrant up 命令,当 Vagrant 尝试启动虚拟机时,将下载正确的框。

So skip the step vagrant box add laravel/homestead所以跳过步骤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. Vagrant 会为你下载并选择正确的 laravel/homestead 版本。

Information source信息来源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM