Composer 版本匹配错误 laravel + 空间媒体库

Composer version matching error laravel + spatie medialibrary

我尝试通过 laravel 安装程序和 laravel new <appname> 创建一个新的 laravel 应用程序。

这没有问题。尝试安装 spatie/medialibrary 后,出现以下我无法解释的错误:

$ composer require "spatie/laravel-medialibrary:^9.0.0"
./composer.json has been updated
Running composer update spatie/laravel-medialibrary
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - spatie/laravel-medialibrary[9.0.0, ..., 9.6.4] require spatie/image ^1.4.0 -> satisfiable by spatie/image[1.4.0, ..., v1.x-dev].
    - spatie/image[1.10.0, ..., v1.x-dev] require league/glide ^1.6 -> satisfiable by league/glide[1.6.0, 1.6.1, 1.7.0, 1.x-dev].
    - spatie/image[1.7.5, ..., 1.9.0] require league/glide ^1.4 -> satisfiable by league/glide[1.4.0, ..., 1.x-dev].
    - league/glide[1.4.0, ..., 1.x-dev] require intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, ..., 2.5.1].
    - intervention/image 2.4.x-dev is an alias of intervention/image dev-master and thus requires it to be installed too.
    - spatie/image 1.10.3 requires league/glide ^2.0 -> satisfiable by league/glide[2.0.0, 2.0.x-dev].
    - intervention/image[dev-master, 2.4.0, ..., 2.5.1] require guzzlehttp/psr7 ~1.1 -> found guzzlehttp/psr7[1.1.0, ..., 1.x-dev] but the package is fixed to 2.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - league/glide 2.0.x-dev requires guzzlehttp/psr7 ^1.1 -> found guzzlehttp/psr7[1.1.0, ..., 1.x-dev] but the package is fixed to 2.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - league/glide 2.0.0 requires league/flysystem ^2.0 -> found league/flysystem[2.0.0-alpha.1, ..., 2.x-dev] but the package is fixed to 1.1.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - spatie/image 1.4.0 requires symfony/process ^3.0 -> found symfony/process[v3.0.0-BETA1, ..., 3.4.x-dev] but the package is fixed to v5.3.2 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - spatie/image[1.4.1, ..., 1.7.4] require symfony/process ^3.0|^4.0 -> found symfony/process[v3.0.0-BETA1, ..., 3.4.x-dev, v4.0.0-BETA1, ..., 4.4.x-dev] but the package is fixed to v5.3.2 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - Root composer.json requires spatie/laravel-medialibrary ^9.0.0 -> satisfiable by spatie/laravel-medialibrary[9.0.0, ..., 9.6.4].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

即使我尝试让 composer 自动 up/downgrade 不匹配的包,我仍然会遇到类似的错误:

$ composer require "spatie/laravel-medialibrary:^9.0.0" -W                                                                                                                             
./composer.json has been updated
Running composer update spatie/laravel-medialibrary --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires laravel/framework ^8.0, found laravel/framework[v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.


Installation failed, reverting ./composer.json and ./composer.lock to their original content.

这也是我的composer.json

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^7.3|^8.0",
        "fideloper/proxy": "^4.4",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.0.1",
        "laravel/framework": "^8.0",
        "laravel/tinker": "^2.5"
    },
    "require-dev": {
        "facade/ignition": "^2.5",
        "fakerphp/faker": "^1.9.1",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.2",
        "nunomaduro/collision": "^5.0",
        "phpunit/phpunit": "^9.3.3"
    },
    "autoload": {
        "psr-4": {
            "App\": "app/",
            "Database\Factories\": "database/factories/",
            "Database\Seeders\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "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"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

作曲家版本:Composer version 2.1.3 2021-06-09 16:31:20

PHP版本:

$ php -v
PHP 7.4.9 (cli)

我不明白这里的问题是什么,laravel 安装的要求已通过全新创建的应用程序满足,medialibrary 包需要版本 7+ 中的 laravel 框架.

我是不是遗漏了什么告诉我哪里出了问题的东西?

谢谢

您可以通过 运行

忽略平台要求
 composer install --ignore-platform-reqs

或升级、降级以此

composer install --with-all-dependencies

并删除 composer.lock 文件(安装前)

sudo rm  composer.lock