📖

LogicException : Unable to prepare route [api/user] for serializ...

2021/10/13に公開約1,600字

php artisan optimizeでのエラー

# pwd
/var/www/html/src
# php artisan optimize
Configuration cache cleared!
Configuration cached successfully!
Route cache cleared!

   LogicException  : Unable to prepare route [api/user] for serialization. Uses Closure.

  at /var/www/html/src/vendor/laravel/framework/src/Illuminate/Routing/Route.php:917
    913|      */
    914|     public function prepareForSerialization()
    915|     {
    916|         if ($this->action['uses'] instanceof Closure) {
  > 917|             throw new LogicException("Unable to prepare route [{$this->uri}] for serialization. Uses Closure.");
    918|         }
    919| 
    920|         $this->compileRoute();
    921| 

  Exception trace:

  1   Illuminate\Routing\Route::prepareForSerialization()
      /var/www/html/src/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteCacheCommand.php:62

  2   Illuminate\Foundation\Console\RouteCacheCommand::handle()
      /var/www/html/src/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36

  Please use the argument -v to see more details.
# 

下記記事を参考にコメントアウトして対処

https://programmer-life.work/php/logicexception-unable-to-prepare-route

https://programming.sincoston.com/laravel6-unable-route-closure/

成功

# pwd
/var/www/html/src
# php artisan optimize
Configuration cache cleared!
Configuration cached successfully!
Route cache cleared!
Routes cached successfully!
Files cached successfully!
# 

以下は解消せず、時期続き調査

file_put_contents(/var/www/html/src/storage/framework/cache/data/0c/73/0c7348042ad26c46f650f503ae217c38c0c11c51): failed to open stream: No such file or directory"

Discussion

ログインするとコメントできます