简体   繁体   English

Laravel 7 致命错误:未捕获的 RuntimeException:尚未设置外观根

[英]Laravel 7 Fatal error: Uncaught RuntimeException: A facade root has not been set

I have looked at several answers suggested to a similar issue but nothing worked in my case.我已经查看了针对类似问题提出的几个答案,但在我的情况下没有任何效果。 FYI, this is my first project in Laravel 7, working fine on my Mac.仅供参考,这是我在 Laravel 7 中的第一个项目,在我的 Mac 上运行良好。 I have deployed the project on my server following this article .按照这篇文章,我已经在我的服务器上部署了这个项目。 When running the project on the web, I get the following error:在 web 上运行项目时,出现以下错误:

Fatal error: Uncaught RuntimeException: A facade root has not been set.致命错误:未捕获的 RuntimeException:尚未设置外观根。 in /usr/www/users/utopiqwvpw/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:258在 /usr/www/users/utopiqwvpw/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:258

Stack trace: #0 /usr/www/users/utopiqwvpw/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(425): Illuminate\Support\Facades\Facade::__callStatic('replaceNamespac...', Array) #1 /usr/www/users/utopiqwvpw/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(402): Illuminate\Foundation\Exceptions\Handler->registerErrorViewPaths() #2 /usr/www/users/utopiqwvpw/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(313): Illuminate\Foundation\Exceptions\Handler->renderHttpException(Object(Symfony\Component\HttpKernel\Exception\HttpException)) #3 /usr/www/users/utopiqwvpw/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(210): Illuminate\Foundation\Exceptions\Handler->prepareResponse(Object(Illuminate\Http\Request), Object(Symfony\Component\HttpKernel\Exception\HttpExcepti in /usr/www/users/utopiqwvpw/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line堆栈跟踪:#0 /usr/www/users/utopiqwvpw/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(425): Illuminate\Support\Facades\Facade::__callStatic('replaceNamespac.. .', Array) #1 /usr/www/users/utopiqwvpw/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(402): Illuminate\Foundation\Exceptions\Handler->registerErrorViewPaths() # 2 /usr/www/users/utopiqwvpw/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(313): Illuminate\Foundation\Exceptions\Handler->renderHttpException(Object(Symfony\Component\HttpKernel\ Exception\HttpException)) #3 /usr/www/users/utopiqwvpw/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(210): Illuminate\Foundation\Exceptions\Handler->prepareResponse(Object( Illuminate\Http\Request), Object(Symfony\Component\HttpKernel\Exception\HttpExcepti in /usr/www/users/utopiqwvpw/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php 上线 258 258

How can I fix it?我该如何解决?

I finally found a solution that worked in my case.我终于找到了适合我的解决方案。

  1. delete the folder vendor删除文件夹供应商
  2. run composer update运行composer update
  3. run php artisan config:cache运行php artisan config:cache
  4. run php artisan config:clear运行php artisan config:clear

Home page now displays but the routes do not work...主页现在显示,但路线不起作用...

If the solution from @Paul Godard doesn't work, it could be a psr/log issue as mine.如果@Paul Godard 的解决方案不起作用,那可能是我的 psr psr/log问题。

My composer update added psr/log v2.0.0, which requires php8 .我的composer update添加了 psr psr/log v2.0.0,它需要 php8 However, my application is on php7.4但是,我的应用程序是在 php7.4

That gave me the exact error output like in the description这给了我确切的错误 output 就像描述中一样

Fatal error: Uncaught RuntimeException: A facade root has not been set. in /usr/www/users/utopiqwvpw/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:258

My solution was to specify in composer.json that I'm using "psr/log": "^1.1.0"我的解决方案是composer.json中指定我正在使用"psr/log": "^1.1.0"

Then run composer update然后运行composer update

暂无
暂无

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

相关问题 将 Symfony 4 应用程序部署到 Heroku(PHP 致命错误:Uncaught RuntimeException: APP_ENV 环境变量未定义) - Deploying Symfony 4 App to Heroku (PHP Fatal error: Uncaught RuntimeException: APP_ENV environment variable is not defined) Laravel 9 在部署后出现“PHP 致命错误:未捕获的 ErrorException:方法 ReflectionParameter::getClass() 已弃用” - Laravel 9 is getting "PHP Fatal error: Uncaught ErrorException: Method ReflectionParameter::getClass() is deprecated in" after deployment Laravel 在包含 autoload.php 时抛出致命错误 - Laravel throws Fatal error when including autoload.php Netbeans-部署WAR错误:模块尚未部署 - Netbeans - deploy WAR error: the module has not been deployed 以 root 身份运行 Laravel Envoy - Run Laravel Envoy as root Azure部署显示错误“已超过传入消息的最大消息大小配额(1048576)。” - Azure deployment showing error “The maximum message size quota for incoming messages (1048576) has been exceeded.” 如何修复 ASP.NET 错误“文件 'nnn.aspx' 尚未预编译,无法请求。”? - How to fix ASP.NET error "The file 'nnn.aspx' has not been pre-compiled, and cannot be requested."? 在没有 Root 权限的服务器上部署 Laravel 项目 - Deploy Laravel Project on a Server without Root Permissions 条目(数据库)已经添加 - The entry (Database) has already been added 如何检查git如果文件夹已更改 - How to check git if folder has been changed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM