在 Symfony 4/5 中安装 orm-fixtures 时作曲家冲突

Composer conflicts when installing orm-fixtures in Symfony 4/5

当我尝试在 Symfony 5.1 中安装 orm-fixtures 时遇到问题:

$ composer require orm-fixtures --dev
Using version ^3.3 for doctrine/doctrine-fixtures-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "5.1.*"
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install doctrine/doctrine-fixtures-bundle 3.3.1
    - Conclusion: remove doctrine/cache 1.10.2
    - Conclusion: don't install doctrine/cache 1.10.2
    - doctrine/common 2.2.1 conflicts with doctrine/cache[1.10.2].
    - doctrine/common 2.2.2 conflicts with doctrine/cache[1.10.2].
    - doctrine/common 2.2.3 conflicts with doctrine/cache[1.10.2].
    - doctrine/common 2.3.0 conflicts with doctrine/cache[1.10.2].
    - Conclusion: don't install doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2.2.2|install doctrine/common 2.2.3|install doctrine/co
mmon 2.3.0
    - Conclusion: don't install doctrine/doctrine-fixtures-bundle 3.3.1|remove doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2.2.2|in
stall doctrine/common 2.2.3|install doctrine/common 2.3.0
    - Conclusion: don't install doctrine/doctrine-fixtures-bundle 3.3.1|don't install doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2
.2.2|install doctrine/common 2.2.3|install doctrine/common 2.3.0
    - Installation request for doctrine/cache (locked at 1.10.2) -> satisfiable by doctrine/cache[1.10.2].
    - Conclusion: don't install doctrine/doctrine-fixtures-bundle 3.3.1|remove doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2.2.2|in
stall doctrine/common 2.2.3|install doctrine/common 2.3.0
    - Conclusion: don't install doctrine/doctrine-fixtures-bundle 3.3.1|don't install doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2
.2.2|install doctrine/common 2.2.3|install doctrine/common 2.3.0
    - Installation request for doctrine/doctrine-fixtures-bundle ^3.3 -> satisfiable by doctrine/doctrine-fixtures-bundle[3.3.0, 3.3.1].
    - Conclusion: remove doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2.2.2|install doctrine/common 2.2.3|install doctrine/common 2.
3.0
    - doctrine/doctrine-fixtures-bundle 3.3.0 requires doctrine/data-fixtures ^1.3 -> satisfiable by doctrine/data-fixtures[1.3.3, 1.4.0, 1.4.1, 1.4.2, 1.4.3, v1.3
.0, v1.3.1, v1.3.2].
    - doctrine/data-fixtures 1.3.3 requires doctrine/common ~2.2 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, 2.2.0, 2.2.1, 2.2.2, 2.2
.3, 2.3.0, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1
, v2.9.0].
    - doctrine/data-fixtures 1.4.0 requires doctrine/common ^2.11 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.11.0].
    - doctrine/data-fixtures 1.4.1 requires doctrine/common ^2.11 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.11.0].
    - doctrine/data-fixtures 1.4.2 requires doctrine/common ^2.11 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.11.0].
    - doctrine/data-fixtures 1.4.3 requires doctrine/common ^2.11 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.11.0].
    - doctrine/data-fixtures v1.3.0 requires doctrine/common ~2.2 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, 2.2.0, 2.2.1, 2.2.2, 2.
2.3, 2.3.0, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.
1, v2.9.0].
    - doctrine/data-fixtures v1.3.1 requires doctrine/common ~2.2 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, 2.2.0, 2.2.1, 2.2.2, 2.
2.3, 2.3.0, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.
1, v2.9.0].
    - doctrine/data-fixtures v1.3.2 requires doctrine/common ~2.2 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, 2.2.0, 2.2.1, 2.2.2, 2.
2.3, 2.3.0, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.
1, v2.9.0].
    - Can only install one of: doctrine/common[2.12.0, 3.0.2].
    - Can only install one of: doctrine/common[2.13.0, 3.0.2].
    - Can only install one of: doctrine/common[2.13.1, 3.0.2].
    - Can only install one of: doctrine/common[2.13.2, 3.0.2].
    - Can only install one of: doctrine/common[2.13.3, 3.0.2].
    - Can only install one of: doctrine/common[v2.11.0, 3.0.2].
    - Can only install one of: doctrine/common[2.2.0, 3.0.2].
    - Can only install one of: doctrine/common[v2.10.0, 3.0.2].
    - Can only install one of: doctrine/common[v2.4.0, 3.0.2].
    - Can only install one of: doctrine/common[v2.4.1, 3.0.2].
    - Can only install one of: doctrine/common[v2.4.2, 3.0.2].
    - Can only install one of: doctrine/common[v2.4.3, 3.0.2].
    - Can only install one of: doctrine/common[v2.5.0, 3.0.2].
    - Can only install one of: doctrine/common[v2.5.1, 3.0.2].
    - Can only install one of: doctrine/common[v2.5.2, 3.0.2].
    - Can only install one of: doctrine/common[v2.5.3, 3.0.2].
    - Can only install one of: doctrine/common[v2.6.0, 3.0.2].
    - Can only install one of: doctrine/common[v2.6.1, 3.0.2].
    - Can only install one of: doctrine/common[v2.6.2, 3.0.2].
    - Can only install one of: doctrine/common[v2.7.0, 3.0.2].
    - Can only install one of: doctrine/common[v2.7.1, 3.0.2].
    - Can only install one of: doctrine/common[v2.7.2, 3.0.2].
    - Can only install one of: doctrine/common[v2.7.3, 3.0.2].
    - Can only install one of: doctrine/common[v2.8.0, 3.0.2].
    - Can only install one of: doctrine/common[v2.8.1, 3.0.2].
    - Can only install one of: doctrine/common[v2.9.0, 3.0.2].
    - Installation request for doctrine/common (locked at 3.0.2) -> satisfiable by doctrine/common[3.0.2].


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

这是我得到的错误。

我知道这个问题来自我的库的版本,但我不知道如何解决我今天才启动 Symfony。

如错误消息中所写:doctrine/doctrine-fixtures-bundle 的最新版本需要 doctrine/data-fixtures。此软件包尚不兼容 doctrine/common v3,但您的系统当前已安装此版本。

无论您如何安装 doctrine/common,都需要将其降级。如果您这样做需要帮助,请编辑您的问题以包含您的 composer.json

更新:确认截至 2020 年 9 月 1 日,该问题已得到解决。夹具现在可以干净地加载而无需任何调整。使用此过程的那些人可能希望从冲突部分删除教义线并进行另一个作曲家更新以恢复同步。

要重现该问题,请从新的 5.1 项目开始并尝试安装固定装置包:

symfony new --full new_project
cd new_project
composer require --dev orm-fixtures

你会收到一条又长又长的错误信息。这是当权者正在努力的事情。这种问题设法通过各种测试过程,实际上有点奇怪。非常罕见。

不过,您可以通过降低条令等级来解决这个问题。将这些条令添加到 composer.json:

    "conflict": {
        "symfony/symfony": "*",
        "doctrine/common": ">= 3.0",
        "doctrine/persistence": "<1.3"
    },

然后,秘密成分,你应该清除作曲家缓存并进行作曲家更新以实际降级学说:

composer clear-cache
composer update
composer require --dev orm-fixtures

它应该可以正常工作。

不过,希望这一切都能在不久的将来得到解决。

正在修复:https://github.com/doctrine/data-fixtures/pull/349/files

同时您可以通过添加

来安装它
"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/fruitwasp/data-fixtures"
    }
],

到您的 composer.json 然后 运行

composer require doctrine/data-fixtures:"dev-doctrinecommon as 1.4.3" --dev
composer require orm-fixtures --dev