diagnosing "Composer: Your requirements could not be resolved to an installable set of packages" issues

huangapple go评论61阅读模式
英文:

diagnosing "Composer: Your requirements could not be resolved to an installable set of packages" issues

问题

我尝试将brianium/paratest从^6.6更新到最新版本的^7.0,现在,当我尝试运行composer install时,我收到以下消息:

无法解析您的要求为可安装的包集合。

  问题 1
    - 根composer.json需要vimeo/psalm ^4.29 -> 可满足于vimeo/psalm[4.29.0, 4.30.0]。
    - brianium/paratest[v7.0.0, ..., v7.0.1]需要phpunit/phpunit ^10.0.3 -> 可满足于phpunit/phpunit[10.0.3, 10.0.4]。
    - phpunit/phpunit[10.0.3, ..., 10.0.4]需要sebastian/diff ^5.0 -> 可满足于sebastian/diff[5.0.0]。
    - 结论:不要安装sebastian/diff 5.0.0(冲突分析结果)
    - 根composer.json需要brianium/paratest ^7.0 -> 可满足于brianium/paratest[v7.0.0, v7.0.1]。

错误:无法解析您的要求为可安装的包集合。

  问题 1
    - 根composer.json需要vimeo/psalm ^4.29 -> 可满足于vimeo/psalm[4.29.0, 4.30.0]。
    - brianium/paratest[v7.0.0, ..., v7.0.1]需要phpunit/phpunit ^10.0.3 -> 可满足于phpunit/phpunit[10.0.3, 10.0.4]。
    - phpunit/phpunit[10.0.3, ..., 10.0.4]需要sebastian/diff ^5.0 -> 可满足于sebastian/diff[5.0.0]。
    - 结论:不要安装sebastian/diff 5.0.0(冲突分析结果)
    - 根composer.json需要brianium/paratest ^7.0 -> 可满足于brianium/paratest[v7.0.0, v7.0.1]。

错误:进程以退出码2完成。

这是我的composer.json:

"require": {
    "php": ">=8.1"
},
"require-dev": {
    "ext-xml": "*",
    "brianium/paratest": "^7.0",
    "friendsofphp/php-cs-fixer": "^3.12",
    "php-parallel-lint/php-parallel-lint": "^1.3",
    "squizlabs/php_codesniffer": "^3.7",
    "vimeo/psalm": "^4.29"
},

我自己不需要sebastian/diff,所以无法将其作为要求删除。根据输出,我猜phpunit/phpunit可能需要sebastian/diff,但如果它是唯一需要sebastian/diff的东西,那么我不明白为什么会有冲突。因此,似乎还有其他东西需要sebastian/diff,尽管可能是不同版本的,但我不知道是什么。

我想我可以查看我的每个依赖项,并考虑升级它们中的每一个,但我不知道...如果我有很多依赖项,那可能会很麻烦。有没有更好的方法来弄清楚发生了什么?

我已经为我的特定composer.json做了这件事,看起来PHP-CS-Fixer/PHP-CS-Fixer(甚至是最新版本的v3.14.3)需要^4.0,而phpunit/phpunit 10.x需要^5.0,所以我想这可能是问题所在,但我觉得我不应该需要查看每个单独的存储库的composer.json 来找出这一点。

英文:

I tried updating brianium/paratest from ^6.6 to the latest version of ^7.0 and now, when I try to run composer install, I get this message:

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

  Problem 1
    - Root composer.json requires vimeo/psalm ^4.29 -> satisfiable by vimeo/psalm[4.29.0, 4.30.0].
    - brianium/paratest[v7.0.0, ..., v7.0.1] require phpunit/phpunit ^10.0.3 -> satisfiable by phpunit/phpunit[10.0.3, 10.0.4].
    - phpunit/phpunit[10.0.3, ..., 10.0.4] require sebastian/diff ^5.0 -> satisfiable by sebastian/diff[5.0.0].
    - Conclusion: don't install sebastian/diff 5.0.0 (conflict analysis result)
    - Root composer.json requires brianium/paratest ^7.0 -> satisfiable by brianium/paratest[v7.0.0, v7.0.1].

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

  Problem 1
    - Root composer.json requires vimeo/psalm ^4.29 -> satisfiable by vimeo/psalm[4.29.0, 4.30.0].
    - brianium/paratest[v7.0.0, ..., v7.0.1] require phpunit/phpunit ^10.0.3 -> satisfiable by phpunit/phpunit[10.0.3, 10.0.4].
    - phpunit/phpunit[10.0.3, ..., 10.0.4] require sebastian/diff ^5.0 -> satisfiable by sebastian/diff[5.0.0].
    - Conclusion: don't install sebastian/diff 5.0.0 (conflict analysis result)
    - Root composer.json requires brianium/paratest ^7.0 -> satisfiable by brianium/paratest[v7.0.0, v7.0.1].

Error: Process completed with exit code 2.

Here's my composer.json:

    "require": {
        "php": ">=8.1"
    },
    "require-dev": {
        "ext-xml": "*",
        "brianium/paratest": "^7.0",
        "friendsofphp/php-cs-fixer": "^3.12",
        "php-parallel-lint/php-parallel-lint": "^1.3",
        "squizlabs/php_codesniffer": "^3.7",
        "vimeo/psalm": "^4.29"
    },

I'm not requiring sebastian/diff myself so I can't remove it as a requirement. Per the output I guess phpunit/phpunit is but if it were the only thing requiring sebastian/diff then I don't see how there'd be a conflict. So it seems like something else must be requiring sebastian/diff, albeit a different version, but I have no idea what.

I suppose I could look at each my deps and consider upgrading each one of them, as well, but idk... that could be a huuuge PITA if I had a lot of deps. Is there no better way to figure out what's going on?

I did do that for my specific composer.json and it looks like PHP-CS-Fixer/PHP-CS-Fixer (even the latest version of v3.14.3) requires ^4.0 whereas phpunit/phpunit 10.x requires ^5.0 so I guess that's the issue but I feel like I shouldn't need to have to look at each individual repo's composer.json to figure that out.

答案1

得分: 5

以下是翻译好的部分:

Just have a look at the requirements of vimeo/psalm. v4 requires sebastian/diff in v3 or v4, as you can see on https://packagist.org/packages/vimeo/psalm#4.29.0, and this is obviously incompatible with PHPUnit v10, as this requires sebastian/diff in v5.
只需查看 vimeo/psalm 的要求。v4 版本需要 sebastian/diff 的 v3 或 v4,如您可以在 https://packagist.org/packages/vimeo/psalm#4.29.0 上看到的,这显然与 PHPUnit v10 不兼容,因为它需要 sebastian/diff 的 v5。

You could check if your application supports running Psalm v5. And if not, this is a great example for why you should not install tools like Psalm using Composer.
您可以检查您的应用程序是否支持运行 Psalm v5。如果不支持,这是一个很好的示例,说明为什么不应该使用 Composer 安装像 Psalm 这样的工具。

Also, next time you run such an update, composer why-not could help. In your example, composer why-not brianium/paratest 7.0.1 could have pointed out the incompatible package.
此外,下次运行类似的更新时,composer why-not 可能会有所帮助。在您的示例中,composer why-not brianium/paratest 7.0.1 可能已指出不兼容的包。

英文:

Just have a look at the requirements of vimeo/psalm. v4 requires sebastian/diff in v3 or v4, as you can see on https://packagist.org/packages/vimeo/psalm#4.29.0, and this is obviously incompatible with PHPUnit v10, as this requires sebastian/diff in v5.

You could check if your application supports running Psalm v5. And if not, this is a great example for why you should not install tools like Psalm using Composer


Also, next time you run such an update, composer why-not could help. In your example, composer why-not brianium/paratest 7.0.1 could have pointed out the incompatible package

huangapple
  • 本文由 发表于 2023年2月6日 22:09:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75362400.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定