laravel Unable to prepare route … for serialization. Uses Closure

前端 未结 8 1783
心在旅途
心在旅途 2020-11-30 04:48

When I clear caches in my Laravel 5.2 project, I see this error message:

[LogicException] Unable to prepare route [panel] for serialization. Uses Closure.

相关标签:
8条回答
  • 2020-11-30 05:16

    If none of your routes contain closures, but you are still getting this error, please check

    routes/api.php

    Laravel has a default auth api route in the above file.

    Route::middleware('auth:api')->get('/user', function (Request $request) {
        return $request->user();
    });
    

    which can be commented or replaced with a call to controller method if required.

    0 讨论(0)
  • 2020-11-30 05:16

    If someone is still looking for an answer, for me the problem was in routes/web.php file. Example:

    Route::get('/', function () {
        return view('welcome');
    });
    

    It is also Route, so yeah...Just remove it if not needed and you are good to go! You should also follow answers provided from above.

    0 讨论(0)
提交回复
热议问题