如何解决symfony Composer依赖冲突?

问题描述 投票:0回答:1

我正在编写一个基于 Symfony v6.4 的 PHP 应用程序,并希望使用

composer require mybuilder/cronos-bundle

安装捆绑包

但是出现错误:

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

Problem 1
    - mybuilder/cronos-bundle 4.0.0 requires doctrine/annotations ^1.11 -> satisfiable by doctrine/annotations[1.11.0, ..., 1.14.3].
    - mybuilder/cronos-bundle[v0.8.0, ..., v0.8.5] require mybuilder/cronos 0.8.* -> found mybuilder/cronos[v0.8.0, v0.8.1, v0.8.2] but it conflicts with your root
 composer.json require (^4.0).
    - mybuilder/cronos-bundle[v0.9.1, ..., v0.9.2] require mybuilder/cronos 0.9.* -> found mybuilder/cronos[v0.9.0, v0.9.1] but it conflicts with your root compose
r.json require (^4.0).
    - mybuilder/cronos-bundle[v1.0.0, ..., 1.0.3] require mybuilder/cronos ~1.0 -> found mybuilder/cronos[1.0.0, v1.0.1, v1.0.2, 1.0.3] but it conflicts with your 
root composer.json require (^4.0).
    - mybuilder/cronos-bundle[2.0.0, ..., 2.1.1, 3.0.2, ..., 3.1.0] require mybuilder/cronos ~2.0 -> found mybuilder/cronos[2.0, 2.0.1, 2.0.2] but it conflicts wit
h your root composer.json require (^4.0).
    - mybuilder/cronos-bundle[3.1.1, ..., 3.2.0] require mybuilder/cronos ~3.0 -> found mybuilder/cronos[3.0.0, 3.0.1, 3.0.2] but it conflicts with your root compo
ser.json require (^4.0).
    - doctrine/annotations[1.10.3, ..., 1.13.3] require doctrine/lexer 1.* -> found doctrine/lexer[v1.0, ..., 1.2.3] but the package is fixed to 3.0.1 (lock file v
ersion) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - doctrine/annotations[1.14.0, ..., 1.14.3] require doctrine/lexer ^1 || ^2 -> found doctrine/lexer[v1.0, ..., 1.2.3, 2.0.0, 2.1.0, 2.1.1] but the package is f
ixed to 3.0.1 (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.
    - Root composer.json requires mybuilder/cronos-bundle * -> satisfiable by mybuilder/cronos-bundle[v0.8.0, ..., v0.9.2, v1.0.0, v1.0.1, v1.0.2, 1.0.3, 2.0.0, 2.
0.1, 2.1.0, 2.1.1, 3.0.2, ..., 3.2.0, 4.0.0].

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 mybuilder/cronos-bundle:*" to figure out if any version is
 installable, or "composer require mybuilder/cronos-bundle:^2.1" if you know which you need.

我正在尝试安装

composer require mybuilder/cronos
,但没有帮助

composer install\composer update --lock,
我正在 osPanel 工作

composer.json

{
    "type": "project",
    "license": "proprietary",
    "minimum-stability": "stable",
    "prefer-stable": true,
    "require": {
        "php": ">=8.1",
        "ext-ctype": "*",
        "ext-curl": "*",
        "ext-iconv": "*",
        "ext-simplexml": "*",
        "doctrine/dbal": "^3",
        "doctrine/doctrine-bundle": "^2.12",
        "doctrine/doctrine-migrations-bundle": "^3.3",
        "doctrine/orm": "^3.1",
        "mybuilder/cronos": "^4.0",
        "phpdocumentor/reflection-docblock": "^5.3",
        "phpstan/phpdoc-parser": "^1.28",
        "symfony/apache-pack": "^1.0",
        "symfony/asset": "6.4.*",
        "symfony/asset-mapper": "6.4.*",
        "symfony/console": "6.4.*",
        "symfony/doctrine-messenger": "6.4.*",
        "symfony/dotenv": "6.4.*",
        "symfony/expression-language": "6.4.*",
        "symfony/flex": "^2.4",
        "symfony/form": "6.4.*",
        "symfony/framework-bundle": "6.4.*",
        "symfony/http-client": "6.4.*",
        "symfony/intl": "6.4.*",
        "symfony/mailer": "6.4.*",
        "symfony/mime": "6.4.*",
        "symfony/monolog-bundle": "^3.0",
        "symfony/notifier": "6.4.*",
        "symfony/process": "6.4.*",
        "symfony/property-access": "6.4.*",
        "symfony/property-info": "6.4.*",
        "symfony/runtime": "6.4.*",
        "symfony/security-bundle": "6.4.*",
        "symfony/serializer": "6.4.*",
        "symfony/stimulus-bundle": "^2.16",
        "symfony/string": "6.4.*",
        "symfony/translation": "6.4.*",
        "symfony/twig-bundle": "6.4.*",
        "symfony/ux-turbo": "^2.16",
        "symfony/validator": "6.4.*",
        "symfony/web-link": "6.4.*",
        "symfony/yaml": "6.4.*",
        "twig/extra-bundle": "^2.12|^3.0",
        "twig/twig": "^2.12|^3.0"
    },
    "config": {
        "allow-plugins": {
            "php-http/discovery": true,
            "symfony/flex": true,
            "symfony/runtime": true
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*",
        "symfony/polyfill-php73": "*",
        "symfony/polyfill-php74": "*",
        "symfony/polyfill-php80": "*",
        "symfony/polyfill-php81": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd",
            "importmap:install": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "6.4.*"
        }
    },
    "require-dev": {
        "phpunit/phpunit": "^9.5",
        "symfony/browser-kit": "6.4.*",
        "symfony/css-selector": "6.4.*",
        "symfony/debug-bundle": "6.4.*",
        "symfony/maker-bundle": "^1.57",
        "symfony/phpunit-bridge": "^7.0",
        "symfony/stopwatch": "6.4.*",
        "symfony/web-profiler-bundle": "6.4.*"
    }
}
symfony installation cron composer-php
1个回答
0
投票

请记住,

doctrine/annotations
即将被淘汰。现在应该使用属性了,但是
mybuilder/cronos-bundle
还不支持。

接下来,v1 中的

doctrine/annotations
已经非常过时了。它与 v3 中的
doctrine/lexer
不兼容,您已将其安装为 v3 中
doctrine/orm
的依赖项。您需要降级到
doctrine/orm
v2.14 才能找到与
doctrine/lexer
v1 兼容的版本。


毕竟,降级大量其他软件包才能安装这个软件包对我来说似乎是一个奇怪的想法。还有很多其他包可以帮助您在 Symfony 应用程序中运行 cronjobs,例如

shapecode/cron-bundle
rewieer/taskschedulerbundle
(免责声明:我是第二个包的维护者)

© www.soinside.com 2019 - 2024. All rights reserved.