[英]Uncaught RuntimeException: A facade root has not been set. in Facade.php:258 when upgrading to Laravel 7
I got the error regarding facade even though I followed the laravel upgrade guide即使我遵循了 laravel 升级指南,我仍然收到有关外观的错误
PHP Fatal error: Uncaught RuntimeException: A facade root has not been set. in D:\Git_Undiksha\legalisir-ijasah-online\vendor\laravel\framework\src\Illuminate\Support\Faca
des\Facade.php:258
Stack trace:
#0 D:\Git_Undiksha\legalisir-ijasah-online\app\Exceptions\Handler.php(39): Illuminate\Support\Facades\Facade::__callStatic('error', Array)
#1 D:\Git_Undiksha\legalisir-ijasah-online\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(366): App\Exceptions\Handler->report(Object(Error))
#2 D:\Git_Undiksha\legalisir-ijasah-online\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(131): Illuminate\Foundation\Console\Kernel->reportException
(Object(Error))
#3 D:\Git_Undiksha\legalisir-ijasah-online\artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Compo
nent\Console\Output\ConsoleOutput))
#4 {main}
thrown in D:\Git_Undiksha\legalisir-ijasah-online\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 258
Fatal error: Uncaught RuntimeException: A facade root has not been set. in D:\Git_Undiksha\legalisir-ijasah-online\vendor\laravel\framework\src\Illuminate\Support\Facades\F
acade.php:258
Stack trace:
#0 D:\Git_Undiksha\legalisir-ijasah-online\app\Exceptions\Handler.php(39): Illuminate\Support\Facades\Facade::__callStatic('error', Array)
#1 D:\Git_Undiksha\legalisir-ijasah-online\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(366): App\Exceptions\Handler->report(Object(Error))
#2 D:\Git_Undiksha\legalisir-ijasah-online\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(131): Illuminate\Foundation\Console\Kernel->reportException
(Object(Error))
#3 D:\Git_Undiksha\legalisir-ijasah-online\artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Compo
nent\Console\Output\ConsoleOutput))
#4 {main}
thrown in D:\Git_Undiksha\legalisir-ijasah-online\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 258
Facade.php:258外观.php:258
public static function __callStatic($method, $args)
{
$instance = static::getFacadeRoot();
if (! $instance) {
throw new RuntimeException('A facade root has not been set.');
}
return $instance->$method(...$args);
}
Here is my composer.json:这是我的作曲家.json:
"require": {
"php": ">=7.2.5",
"laravel/framework": "^7.0",
"nunomaduro/collision": "^4.1",
"laravel/tinker": "^2.0",
"facade/ignition": "^2.0"
},
"require-dev": {
"composer/composer": "^1.10",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "^9.1"
},
I did change the Handler.php Exception to Throwable, session.php secure env from false to null, and set any handle() command return to integer. I did change the Handler.php Exception to Throwable, session.php secure env from false to null, and set any handle() command return to integer.
How do I solve the facade error and what should I do?如何解决外观错误,我该怎么办?
After making a new working Laravel version 7 project, copy the app and config folders to the new one (for testing purpose), renaming a file and then testing with php artisan --version
every changes I made (rename each no-numbered files to (1) and (2) files to no-numbered), finally I found out what is the problem: config/excel.php在制作一个新的 Laravel 版本 7 项目后,将 app 和 config 文件夹复制到新的(用于测试目的),重命名一个文件,然后使用
php artisan --version
我所做的每个更改进行测试(将每个无编号文件重命名为(1)和(2)文件无编号),最后我发现了问题所在:config/excel.php
in excel.php I commented autosize-method and it works!在 excel.php 我评论了 autosize-method 并且它有效!
// 'autosize-method' => PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.