phplaravellaravel-6laravel-upgrade

Upgrade laravel 5.8 to 6: Fatal error: Uncaught RuntimeException: A facade root has not been set


I am trying to upgrade laravel 5.8 to 6. I have also deleted the vendor Directory But still getting the following error:

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```

Solution

  • In your composer.json file you should have this:

    "laravel/framework": "^6.0",
    "php": "^7.2",
    "phpunit/phpunit": "^8.0"
    

    and then in console execute composer update, so if you are using the helpers String and Array on this case you need install the package laravel/helpers with this command:

    composer require laravel/helpers
    

    and after that change the helpers with calling to methods of classes Illuminate\Support\Str and Illuminate\Support\Arr, if you have other issues please share here your composer.json for see more details.