gpt4 book ai didi

php - Composer - illuminate/redis 安装失败,因为 illuminate/support 版本不同

转载 作者:IT王子 更新时间:2023-10-29 06:08:34 28 4
gpt4 key购买 nike

我为一个新项目创建了 Lumen 的全新安装,我正在尝试将 Redis 设置为缓存/ session 驱动程序。通过 Composer ,我能够毫无问题地安装 Predis,然后在尝试运行时:

composer require illuminate/redis

我收到这个错误,它告诉我 Composer 被混淆了,因为不同的库要求不同版本的 illuminate/support,正如我从 this question 中了解到的那样:

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

Problem 1
- Can only install one of: illuminate/support[v5.2.0, v5.1.25].
- Can only install one of: illuminate/support[v5.2.0, v5.1.25].
- Can only install one of: illuminate/support[v5.2.0, v5.1.25].
- illuminate/redis v5.2.0 requires illuminate/support 5.2.* -> satisfiable by illuminate/support[v5.2.0].
- Installation request for illuminate/redis ^5.2 -> satisfiable by illuminate/redis[v5.2.0].
- Installation request for illuminate/support == 5.1.25.0 -> satisfiable by illuminate/support[v5.1.25].


Installation failed, reverting ./composer.json to its original content.

下面是我的 composer.json,它非常基础:

{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": ["framework", "laravel", "lumen"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/lumen-framework": "5.1.*",
"vlucas/phpdotenv": "~1.0",
"predis/predis": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"fzaninotto/faker": "~1.0"
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/"
]
},
"autoload-dev": {
"classmap": [
"tests/"
]
},
"config": {
"preferred-install": "dist"
}
}

我的问题是,我做错了什么? ,上面链接的问题建议手动更改以解决此问题。但我相信设置是如此基本,我应该在这里做错什么。

最佳答案

我必须使用所需版本的 illuminate/redis 编辑 composer.json 文件;强制它使用相同的版本,如下所示:

{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": ["framework", "laravel", "lumen"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/lumen-framework": "5.1.*",
"vlucas/phpdotenv": "~1.0",
"predis/predis": "^1.0",
"illuminate/redis" : "5.1.*"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"fzaninotto/faker": "~1.0"
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/"
]
},
"autoload-dev": {
"classmap": [
"tests/"
]
},
"config": {
"preferred-install": "dist"
}
}

关于php - Composer - illuminate/redis 安装失败,因为 illuminate/support 版本不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34443492/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com