Laravel 5.6 - Uncaught RuntimeException: A facade root has not been set

You need to create a new app container and then bind it to the Facade.

use \Illuminate\Container\Container as Container;
use \Illuminate\Support\Facades\Facade as Facade;

/**
* Setup a new app instance container
* 
* @var Illuminate\Container\Container
*/
$app = new Container();
$app->singleton('app', 'Illuminate\Container\Container');

/**
* Set $app as FacadeApplication handler
*/
Facade::setFacadeApplication($app);

in lumen: bootstrap/app.php

$app->withFacades();

Good luck!


I know this is old but maybe it will help someone. I ran into this problem after I was fiddling with my app/config.php file. I added some options and accidentally put a semi-colon instead of a comma after it. I had:

'vapid_public_key'   => env('VAPID_PUBLIC_KEY'); <--- offending semi-colon
'vapid_private_key'  => env('VAPID_PRIVATE_KEY'),

Changed it to the proper comma and everything works as expected.