无法要求laravel/passport与composer

yptwkmov  于 2023-04-22  发布在  其他
关注(0)|答案(3)|浏览(139)

当我执行composer require laravel/passport时,我得到
将^5.0版用于laravel/passport./composer. json已更新正在加载包含包信息的composer存储库更新依赖项(包括require-dev)无法将您的要求解析为可安装的包集。
问题1 -安装请求laravel/passport ^5.0 -〉satisfiable by laravel/passport[v5.0.0]. -结论:remove laravel/framework v5.5.34 -结论:不要安装laravel/framework v5.5.34 - laravel/passport v5.0.0 requires illuminate/encryption ~5.6 -〉satisfiable by illuminate/encryption[v5.6.0,v5.6.1,v5.6.2,v5.6.3]. -不要安装illuminate/encryption v5.6.0|不要安装laravel/framework v5.5.34 -不要安装illuminate/encryption v5.6.1|不要安装laravel/framework v5.5.34 -不要安装illuminate/encryption v5.6.2|不要安装laravel/framework v5.5.34 -不要安装illuminate/encryption v5.6.3|don't install laravel/framework v5.5.34 - Installation request for laravel/framework(locked at v5.5.34,required as 5.5.*)-〉satisfiable by laravel/framework[v5.5.34].
安装失败,正在将./composer.json还原为其原始内容。
我认为这意味着我的illuminate/encryption版本与此版本的laravel/passport不兼容
这是正确的吗?解决这个问题的最佳方法是什么?我甚至不知道如何查看我拥有的illuminate/encryption的版本。它不会显示在composer show中。
这里是我的composer.json

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=7.0.0",
        "fideloper/proxy": "~3.3",
        "laravel/framework": "5.5.*",
        "laravel/tinker": "~1.0",
        "tymon/jwt-auth": "dev-develop"
    },
    "require-dev": {
        "filp/whoops": "~2.0",
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "~1.0",
        "phpunit/phpunit": "~6.0",
        "symfony/thanks": "^1.0"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
            ]
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    }
}
xa9qqrwz

xa9qqrwz1#

Passport 5.0依赖于Illuminate包的5.6版本。我可以看到你安装了Laravel 5.5,所以要么升级Laravel到5.6,要么使用Passport的4.0分支。
Passport存储库中composer.json"require"部分指定了所有内容:

"require": {
    "php": ">=7.0",
    "firebase/php-jwt": "~3.0|~4.0|~5.0",
    "guzzlehttp/guzzle": "~6.0",
    "illuminate/auth": "~5.6",
    "illuminate/console": "~5.6",
    "illuminate/container": "~5.6",
    "illuminate/contracts": "~5.6",
    "illuminate/database": "~5.6",
    "illuminate/encryption": "~5.6",
    "illuminate/http": "~5.6",
    "illuminate/support": "~5.6",
    "league/oauth2-server": "^6.0",
    "phpseclib/phpseclib": "^2.0",
    "symfony/psr-http-message-bridge": "~1.0",
    "zendframework/zend-diactoros": "~1.0"
},

Illuminate版本号与框架一致,因此Laravel 5.6将使用Illuminate 5.6,5.5将使用Illuminate 5.5等。
参见:Upgrade Guide - Upgrading To 5.6.0 From 5.5

7lrncoxx

7lrncoxx2#

我在使用Laravel Framework 5.4时遇到了同样的问题
使用较低版本的passport解决了问题
composer require laravel/passport "4.0.3"

bq9c1y66

bq9c1y663#

我得到了这个相同的问题我解决了这个使用以下命令
composer require laravel/passport -W
-W(--with-all-dependencies)允许对当前锁定到特定版本的软件包进行升级、降级和删除。

相关问题