Search code examples
lumenlumen-5.2lumen-routing

Lumen installation error


I am trying to install lumen with composer so I used the command below

composer create-project --prefer-dist laravel/lumen api

But, for some reason I am getting this error before even doing anything, just visiting the public folder.

Sorry, the page you are looking for could not be found.

1/1
NotFoundHttpException in RoutesRequests.php line 442:
in RoutesRequests.php line 442
at Application->handleDispatcherResponse(array('0')) in RoutesRequests.php line 381
at Application->Laravel\Lumen\Concerns{closure}() in RoutesRequests.php line 624
at Application->sendThroughPipeline(array(), object(Closure)) in RoutesRequests.php line 382
at Application->dispatch(null) in RoutesRequests.php line 327
at Application->run() in index.php line 28

Solution

  • Assuming you are running lumen from a subdirectory, in public/index.php change:

    $app->run();
    

    to

    $request = Illuminate\Http\Request::capture();
    $app->run($request);
    

    That did the trick for me.