Search code examples
phplaravelcomposer-phplaravel-8php-8

How to fix laravel/ui error to upgrade Laravel after upgrading PHP to 8.0


I'm trying to upgrade Laravel after PHP was upgraded to 8.0 with brew on macos, but I'm getting the errors below. How should I fix it ?

$ composer update                                                                                                                  ✔ │ 59% hdd │ 5.43G RAM │ 14:05:07 │ ⇣0.18 KiB/s ⇡1.51 KiB/s 192.168.1.69 IP │ 213.163.173.1 IP 
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install laravel/framework v8.12.0 (conflict analysis result)
    - Conclusion: don't install laravel/framework v8.12.1 (conflict analysis result)
    - Conclusion: don't install laravel/framework v8.12.2 (conflict analysis result)
    - Conclusion: don't install laravel/framework v8.12.3 (conflict analysis result)
    - Conclusion: don't install laravel/framework v8.13.0 (conflict analysis result)
    - Conclusion: don't install laravel/framework v8.14.0 (conflict analysis result)
    - Conclusion: don't install laravel/framework v8.15.0 (conflict analysis result)
    - Conclusion: don't install laravel/framework v8.16.0 (conflict analysis result)
    - Conclusion: don't install laravel/framework v8.16.1 (conflict analysis result)
    - Conclusion: don't install laravel/framework v8.17.0 (conflict analysis result)
    - Conclusion: don't install laravel/framework v8.17.1 (conflict analysis result)
    - Conclusion: don't install laravel/framework v8.17.2 (conflict analysis result)
    - Conclusion: don't install laravel/framework v8.18.0 (conflict analysis result)
    - Conclusion: don't install laravel/framework v8.18.1 (conflict analysis result)
    - laravel/ui[v2.1.0, ..., v2.4.1] require php ^7.2.5 -> your php version (8.0.0) does not satisfy that requirement.
    - illuminate/support[v7.0.0, ..., v7.28.4] require php ^7.2.5 -> your php version (8.0.0) does not satisfy that requirement.
    - laravel/framework[v8.0.0, ..., v8.11.2] require php ^7.3 -> your php version (8.0.0) does not satisfy that requirement.
    - laravel/ui[v2.5.0, ..., 2.x-dev] require illuminate/support ^7.0 -> satisfiable by illuminate/support[v7.0.0, ..., 7.x-dev].
    - Only one of these can be installed: illuminate/support[dev-master, v5.5.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev], laravel/framework[v8.0.0, ..., 8.x-dev]. laravel/framework replaces illuminate/support and thus cannot coexist with it.
    - Root composer.json requires laravel/framework ^8.0 -> satisfiable by laravel/framework[v8.0.0, ..., 8.x-dev].
    - Root composer.json requires laravel/ui ^2.1 -> satisfiable by laravel/ui[v2.1.0, ..., 2.x-dev].

=== EDIT 2020-12-10 ===

composer.json:

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^8.0",
        "fideloper/proxy": "^4.2",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.0.1",
        "laravel/framework": "^8.0",
        "laravel/passport": "^10.0.1",
        "laravel/tinker": "^2.0",
        "laravel/ui": "^2.1"
    },
    "require-dev": {
        "facade/ignition": "^2.3.6",
        "fakerphp/faker": "^1.9.1",
        "mockery/mockery": "^1.3.1",
        "nunomaduro/collision": "^5.0",
        "phpunit/phpunit": "^9.3"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}

Below


Solution

  • As written in these multiple lines of errors: you are using outdated packages that are not yet compatible with PHP 8, nor with each other.

    You require laravel/ui in v2 which does only support Laravel v7, along with laravel/framework which is the core of Laravel v8. Either update laravel/ui to v3, or downgrade Laravel to v7. This problem does not related to PHP8 from my point of view - it's a miracle that you haven't had any problems before