PHP 8.1.8
Composer version 2.3.10 2022-07-13 15:48:23
Ubuntu 22.04 LTS
执行
composer require psr/container ^1.1.1 illuminate/redis symfony/cache
Using version ^9.20 for illuminate/redis
Using version ^6.1 for symfony/cache
./composer.json has been updated
Running composer update psr/container illuminate/redis symfony/cache
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 illuminate/redis ^9.20 -> satisfiable by illuminate/redis[v9.20.0].
- illuminate/redis v9.20.0 requires illuminate/collections ^9.0 -> found illuminate/collections[v9.0.0, ..., v9.20.0] but the package is fixed to v8.83.19 (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.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require illuminate/redis:*" to figure out if any version is installable, or "composer require illuminate/redis:^2.1" if you know which you need.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
感觉是和默认的
"illuminate/database": "^8.83"
对应的插件冲突了
按照提示使用了-W
参数还是相同的报错,我的composer.json的配置文件内容如下
{
"name": "workerman/webman",
"type": "project",
"keywords": [
"high performance",
"http service"
],
"homepage": "http://www.workerman.net",
"license": "MIT",
"description": "High performance HTTP Service Framework.",
"authors": [
{
"name": "walkor",
"email": "walkor@workerman.net",
"homepage": "http://www.workerman.net",
"role": "Developer"
}
],
"support": {
"email": "walkor@workerman.net",
"issues": "https://github.com/walkor/webman/issues",
"forum": "http://wenda.workerman.net/",
"wiki": "http://workerman.net/doc/webman",
"source": "https://github.com/walkor/webman"
},
"require": {
"php": ">=7.2",
"workerman/webman-framework": "^1.3.14",
"monolog/monolog": "^2.0",
"psr/container": "^1.1.1",
"illuminate/database": "^8.83",
"illuminate/pagination": "^8.83",
"illuminate/events": "^8.83",
"symfony/var-dumper": "^5.4",
"vlucas/phpdotenv": "^5.4",
"mouyong/validate": "^2.0"
},
"suggest": {
"ext-event": "For better performance. "
},
"autoload": {
"psr-4": {
"": "./",
"App\\": "./app"
},
"files": [
"./support/helpers.php"
]
},
"scripts": {
"post-package-install": [
"support\\Plugin::install"
],
"post-package-update": [
"support\\Plugin::install"
],
"pre-package-uninstall": [
"support\\Plugin::uninstall"
]
}
}
看提示意思好像是你composer.json设置了illuminate/collections的版本v8.83.19,而illuminate/redis 依赖 illuminate/collections ^9.0,和你本地v8.83.19冲突。让你加-W参数呢,
composer require psr/container ^1.1.1 illuminate/redis symfony/cache -W
已经尝试过了,还是相同的错误,我使用了一个插件市场里的Laravel的验证器,不知道是否是那个版本有限制了。
这个问题解决了,将composer.json里的对应的库的版本修正为 ^9.20 ,然后update,然后再安装就可以成功了。