Laravel 6 : A facade root has not been set
Asked Answered
C

3

6

I have migrate my website from Laravel 5.8 to Laravel 6, after a composer update i have this error on the website and also with just a command php artisan :

PHP Fatal error:  Uncaught RuntimeException: A facade root has not been set. in /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:242
Stack trace:
#0 /var/www/html/app/Exceptions/Handler.php(48): Illuminate\Support\Facades\Facade::__callStatic('check', Array)
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(376): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(141): Illuminate\Foundation\Console\Kernel->reportException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#3 /var/www/html/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 {main}
  thrown in /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 242

Fatal error: Uncaught RuntimeException: A facade root has not been set. in /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:242
Stack trace:
#0 /var/www/html/app/Exceptions/Handler.php(48): Illuminate\Support\Facades\Facade::__callStatic('check', Array)
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(376): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(141): Illuminate\Foundation\Console\Kernel->reportException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#3 /var/www/html/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 {main}
  thrown in /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 242 

I have taken a new laravel 6 file config\app.php and a new .env But always this error...

How can I solve it?

Capital answered 28/11, 2019 at 8:58 Comment(0)
W
3

I know, the answer is a bit late :) But still I believe it could help someone else who will experience this issue.

The replacing all str_slug() methods by Str::slug() fixes the problem. In my case, I found old helpers in the config/cache.php and config/session.php files.

Weinstein answered 28/8, 2020 at 12:21 Comment(0)
C
2

Finally i find a solution, i copy a laravel 6 config file : config/session.php and it's works.

Capital answered 28/11, 2019 at 10:35 Comment(1)
In my case, I took also the config/cache.php file from the original repo.Weinstein
I
0

I was getting these errors - my own fault - I was moving my Laravel application files into a subdirectory, looks like app.php as well as a few other files were missing from my /config/ directory:

cache.php
cors.php
filesystems.php
hashing.php
logging.php
mail.php
services.php
session.php
view.php

Should be:

app.php
auth.php
broadcasting.php
cache.php
cors.php
database.php
filesystems.php
hashing.php
logging.php
mail.php
queue.php
services.php
session.php
view.php
Ingrained answered 1/10, 2020 at 1:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.