[root@iZ2zebcbq4eh7vehzld7x4Z webman.zhangtr.com]# composer require psr/container ^1.1.1 illuminate/database jenssegers/mongodb
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? y
Info from https://repo.packagist.org: #StandWithUkraine
Using version ^7.30 for illuminate/database
Using version ^3.9 for jenssegers/mongodb
./composer.json has been updated
Running composer update psr/container illuminate/database jenssegers/mongodb
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
jenssegers/mongodb[v3.9.0, ..., v3.9.5] require illuminate/database ^9.0 -> found illuminate/database[v9.0.0, ..., v9.52.7] but it conflicts with your root composer.json require (^7.30).
看提示啊,翻译过来就是你本地composer.json写死了illuminate/database版本 7.30,但是jenssegers/mongodb需要 illuminate/database8.0或者9.0。运行
composer illuminate/database ^8.0
或者composer illuminate/database ^8.0
升级下就好了 。完整composer.json如下,没看到有写死illuminate/database版本 7.30
{
"name": "workerman/webman",
"type": "project",
"keywords": [
"high performance",
"http service"
],
"homepage": "https://www.workerman.net",
"license": "MIT",
"description": "High performance HTTP Service Framework.",
"authors": [
{
"name": "walkor",
"email": "walkor@workerman.net",
"homepage": "https://www.workerman.net",
"role": "Developer"
}
],
"support": {
"email": "walkor@workerman.net",
"issues": "https://github.com/walkor/webman/issues",
"forum": "https://wenda.workerman.net/",
"wiki": "https://workerman.net/doc/webman",
"source": "https://github.com/walkor/webman"
},
"require": {
"php": ">=7.2",
"workerman/webman-framework": "^1.5.0",
"monolog/monolog": "^2.0",
"psr/container": "^1.1.1",
"webman/think-orm": "^1.1",
"vlucas/phpdotenv": "^5.1.0"
},
"suggest": {
"ext-event": "For better performance. "
},
"autoload": {
"psr-4": {
"": "./",
"app\": "./app",
"App\": "./app",
"app\View\Components\": "./app/view/components"
},
"files": [
"./support/helpers.php"
]
},
"scripts": {
"post-package-install": [
"support\Plugin::install"
],
"post-package-update": [
"support\Plugin::install"
],
"pre-package-uninstall": [
"support\Plugin::uninstall"
]
}
}
应该是你php版本不支持 illuminate/database 8.0以上版本,自动选择了 illuminate/database 7.3
我用的php7.2的版本
composer require psr/container ^1.1.1 illuminate/database jenssegers/mongodb
不指定jenssegers/mongodb版本就好了
不指定还是报错,方便加个微信15822836709,谢谢
[root@iZ2zebcbq4eh7vehzld7x4Z webman.zhangtr.com]# composer require psr/container ^1.1.1 illuminate/database jenssegers/mongodb
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? y
Info from https://repo.packagist.org: #StandWithUkraine
Using version ^7.30 for illuminate/database
Using version ^3.9 for jenssegers/mongodb
./composer.json has been updated
Running composer update psr/container illuminate/database jenssegers/mongodb
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
那就指定一个低版本, composer require psr/container ^1.1.1 illuminate/database jenssegers/mongodb ^v3.7
不行版本就再降