[英]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.我终于找到了适合我的解决方案。
composer update
composer update
php artisan config:cache
php artisan config:cache
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.