将 laravel 5.8 升级到 6:致命错误:未捕获的 RuntimeException:尚未设置外观根
Posted
技术标签:
【中文标题】将 laravel 5.8 升级到 6:致命错误:未捕获的 RuntimeException:尚未设置外观根【英文标题】:Upgrade laravel 5.8 to 6: Fatal error: Uncaught RuntimeException: A facade root has not been set 【发布时间】:2021-10-13 17:19:27 【问题描述】:我正在尝试将 laravel 5.8 升级到 6。 我也删除了供应商目录但仍然收到以下错误:
Fatal error: Uncaught RuntimeException: A facade root has not been set. in C:\xampp8.2.0\htdocs\web_kaalo - 5.8\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:258
#0 C:\xampp8.2.0\htdocs\web_kaalo - 5.8\app\Exceptions\Handler.php(44): Illuminate\Support\Facades\Facade::__callStatic('set', Array)
#1 C:\xampp8.2.0\htdocs\web_kaalo - 5.8\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(376): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#2 C:\xampp8.2.0\htdocs\web_kaalo - 5.8\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(141): Illuminate\Foundation\Console\Kernel->reportException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#3 C:\xampp8.2.0\htdocs\web_kaalo - 5.8\artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 main
thrown in C:\xampp8.2.0\htdocs\web_kaalo - 5.8\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 258
PHP Fatal error: Uncaught RuntimeException: A facade root has not been set. in C:\xampp8.2.0\htdocs\web_kaalo - 5.8\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:258
Stack trace:
#0 C:\xampp8.2.0\htdocs\web_kaalo - 5.8\app\Exceptions\Handler.php(44): Illuminate\Support\Facades\Facade::__callStatic('set', Array)
#1 C:\xampp8.2.0\htdocs\web_kaalo - 5.8\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(376): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#2 C:\xampp8.2.0\htdocs\web_kaalo - 5.8\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(141): Illuminate\Foundation\Console\Kernel->reportException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#3 C:\xampp8.2.0\htdocs\web_kaalo - 5.8\artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 main
thrown in C:\xampp8.2.0\htdocs\web_kaalo - 5.8\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 258```
【问题讨论】:
你读过那个问题https://***.com/questions/59084991/laravel-6-a-facade-root-has-not-been-set 这能回答你的问题吗? Laravel 6 : A facade root has not been set 【参考方案1】:在你的 composer.json 文件中你应该有这个:
"laravel/framework": "^6.0",
"php": "^7.2",
"phpunit/phpunit": "^8.0"
然后在控制台中执行composer update
,所以如果你使用的是助手字符串和数组
在这种情况下,您需要使用以下命令安装包 laravel/helpers:
composer require laravel/helpers
然后通过调用类的方法来更改助手
Illuminate\Support\Str
和 Illuminate\Support\Arr
,如果您有其他问题,请在此处分享您的 composer.json 以查看更多详细信息。
【讨论】:
以上是关于将 laravel 5.8 升级到 6:致命错误:未捕获的 RuntimeException:尚未设置外观根的主要内容,如果未能解决你的问题,请参考以下文章
未捕获的错误:将 laravel 5.8 升级到 8 后调用未定义的函数 Illuminate\Mail\TransportManager()
从 Laravel 5.8 升级到 6.2 后 ConfirmPasswordController 不存在
PHP 致命错误:未捕获的错误:使用 Laravel 5.8 和 PHP 7.4 调用未定义函数 Whoops\Exception\xdebug_is_enabled()