'A facade root has not been set after composer require

I tried to install laravel-debugbar on my project, but after the composer require barryvdh/laravel-debugbar --dev I get this error on console

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In Facade.php line 258:

  A facade root has not been set.


Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Now, I can't access to my project localhost did not send any data. ERR_EMPTY_RESPONSE

There is no record in the log, also, I don't have the mentioned file in my project either

Note: I can't run artisan optimize or clear caches

Logs:

    [2022-03-05 14:42:04] laravel.ERROR: A facade root has not been set. {"exception":"[object] (RuntimeException(code: 0): A facade root has not been set. at /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:258)
[stacktrace]
#0 /var/www/html/config/forrest.php(33): Illuminate\\Support\\Facades\\Facade::__callStatic()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(72): require('...')
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(39): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->loadConfigurationFiles()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(237): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->bootstrap()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(310): Illuminate\\Foundation\\Application->bootstrapWith()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(127): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#6 /var/www/html/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#7 {main}
"} 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source