laravel中软件包之间的冲突

6tr1vspr  于 2023-02-10  发布在  其他
关注(0)|答案(1)|浏览(317)

我正在尝试安装两个包。passport和auth。Auth是因为passport需要这个包,但是当尝试安装passport时,它说它已经找到了一个版本,但是由于与另一个包冲突而没有激活/安装。
我不知道,我在这里做了一些测试,但是我解不出来。我真的需要帮助
我将把composer.json放在下面

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.2.5|^8.0",
        "aws/aws-sdk-php": "^3.208",
        "fideloper/proxy": "^4.4",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^6.3",
        "kitetail/zttp": "^0.6.0",
        "laracasts/flash": "^3.2",
        "laravel/framework": "^7.29",
        "laravel/tinker": "^2.5",
        "laravel/ui": "2.4",
        "maatwebsite/excel": "^3.1",
        "timehunter/laravel-google-recaptcha-v2": "~1.0.0"
    },
    "require-dev": {
        "facade/ignition": "^2.0",
        "fakerphp/faker": "^1.9.1",
        "lucascudo/laravel-pt-br-localization": "^1.1",
        "mockery/mockery": "^1.3.1",
        "nunomaduro/collision": "^4.3",
        "phpunit/phpunit": "^8.5.8|^9.3.3"
    },
    "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-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"
        ]
    }
}

以下是尝试安装每个软件包时收到的错误/警告
composer 需要laravel/护照:

Your requirements could not be resolved to an installable set of packages.

Problem 1
    - Root composer.json requires laravel/passport ^10.4 -> satisfiable by laravel/passport[v10.4.0, v10.4.1, 10.x-dev].
    - laravel/passport[v10.4.0, ..., 10.x-dev] require illuminate/auth ^8.37|^9.0 -> found illuminate/auth[v8.37.0, ..., 8.x-dev, v9.0.0-beta.1, ..., 9.x-dev] but these were not loaded, likely because it conflicts with another require.

You can also try re-running composer require with an explicit version constraint, e.g. "composer require laravel/passport:*" to figure out if any version is installable, or "composer require laravel/passport:^2.1" if you know which you need.

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

编写器需要照明/授权^8.37:

Your requirements could not be resolved to an installable set of packages.

Problem 1                                                                                                                                   
    - Root composer.json requires illuminate/auth 8.37, found illuminate/auth[v8.37.0] but these were not loaded, likely because it conflicts with another require. 

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

rsl1atfo1#

看起来illuminate/auth和laravel/passport两个包不一致,你项目中的另一个包需要一个不兼容的illuminate/auth版本,而laravel/passport包需要的是illuminate/auth版本^8.37|^9.0。
通过提供要安装在项目中的influation/auth的精确版本,您可以尝试通过执行以下命令来解决争议:

composer require illuminate/auth:^8.37

之后,您可以尝试再次安装laravel/passport:

composer require laravel/passport

如果问题仍然存在,您应该检查项目中其他包的版本,看看它们是否需要不同版本的illuminate/auth。您可以使用composer show命令来显示特定包的信息,例如:

composer show illuminate/auth

如果仍然无法解决冲突,可以尝试删除所有软件包,然后运行以下命令重新开始:

composer install --no-plugins --no-scripts

相关问题