mardi 5 mars 2019

Laravel update to 5.8, updating dependencies

I currently have laravel updated to 5.8 from 5.2. Through the process I have it working and displaying the site, but I don't have all of the 5.8 dependencies added in that would be there as if I started the project from scratch on 5.8. So I created a laravel project from scratch to see what would be included and I started moving things over slowly. Currently I am trying to get the composer.json almost identical to a new laravel 5.8 project. This is what was working --

{
  "name": "laravel/laravel",
  "description": "The Laravel Framework.",
  "keywords": [ "framework", "laravel" ],
  "license": "MIT",
  "type": "project",
  "require": {
    "php": "^7.1.3",
    "laravel/framework": "5.8.*",
    "intervention/image": "^2.3",
    "guzzlehttp/guzzle": "^6.2",
    "fideloper/proxy": "^4.0",
    "laravel/cashier": "~7.0",
    "codedge/laravel-fpdf": "^1.0",
    "phpseclib/phpseclib": "1.0.*",
    "laravelcollective/html": "~5.0",
    "maatwebsite/excel": "^2.1",
    "phpoffice/phpspreadsheet": "^1.4"
  },
  "require-dev": {
    "fzaninotto/faker": "~1.4",
    "filp/whoops": "~2.0",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "^7.5",
    "symfony/css-selector": "^4.0",
    "symfony/dom-crawler": "^4.0"
  },
  "autoload": {
    "classmap": [
      "database"
    ],
    "psr-4": {
      "App\\": "app/"
    }
  },
  "autoload-dev": {
    "classmap": [
      "tests/TestCase.php"
    ]
  },
  "scripts": {
    "post-root-package-install": [
      "php -r \"copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
      "php artisan key:generate"
    ],
    "post-install-cmd": [
      "Illuminate\\Foundation\\ComposerScripts::postInstall",
      "php artisan optimize"
    ],
    "post-update-cmd": [
      "Illuminate\\Foundation\\ComposerScripts::postUpdate",
      "php artisan optimize"
    ],
    "post-autoload-dump": [
      "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
      "@php artisan package:discover"
    ]
  },
  "config": {
    "preferred-install": "dist"
  }
}

Which I've changed to --

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": "^7.1.3",
        "laravel/framework": "5.8.*",
        "intervention/image": "^2.3",
        "guzzlehttp/guzzle": "^6.2",
        "fideloper/proxy": "^4.0",
        "laravel/cashier": "~7.0",
        "codedge/laravel-fpdf": "^1.0",
        "phpseclib/phpseclib": "1.0.*",
        "laravelcollective/html": "~5.0",
        "maatwebsite/excel": "^2.1",
        "phpoffice/phpspreadsheet": "^1.4",
        "laravel/tinker": "^1.0"
    },
    "require-dev": {
        "beyondcode/laravel-dump-server": "^1.0",
        "fzaninotto/faker": "^1.4",
        "filp/whoops": "^2.0",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "phpunit/phpunit": "^7.5",
        "symfony/css-selector": "^4.0",
        "symfony/dom-crawler": "^4.0"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ]
    }
}

After trying to run this update script though I get an error that looks like this.

Package manifest generated successfully.
> post-update-cmd: Illuminate\Foundation\ComposerScripts::postUpdate
> post-update-cmd: php artisan optimize
Configuration cache cleared!
Configuration cached successfully!
Route cache cleared!

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

  at C:\Base\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()
      C:\Base\vendor\laravel\framework\src\Illuminate\Foundation\Console\RouteCacheCommand.php:62

  2   Illuminate\Foundation\Console\RouteCacheCommand::handle()
      C:\Base\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:32

  Please use the argument -v to see more details.
Script php artisan optimize handling the post-update-cmd event returned with error code 1

Any Suggestions



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire