且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

composer.json 无法解析可安装的软件包集

更新时间:2023-11-16 23:23:04

这里的关键部分如下:

[...]
white-october/pagerfanta-bundle dev-master requires symfony/framework-bundle >=2.2,<3.0 -> satisfiable by symfony/symfony[v2.2.0, v2.2.1], symfony/framework-bundle[v2.2.0, v2.2.1].
[...]

这会导致混乱!让我解释一下:

Which can lead to confusion! Let me explain:

虽然它说可以通过将 symfony/symfony 更新到 2.2.0 或 2.2.1 来满足依赖关系......这个更新是 不需要 !!(即使更新可能是个好主意,也没有必要解决问题,并且可能由于 BC [向后兼容性] 中断而导致代码损坏)

Though it says the dependency is satisfiable by updating symfony/symfony to 2.2.0 or 2.2.1 ... this update is NOT NEEDED !! ( even if updating might be a good idea it is not necessary to resolve the issue and could lead to broken code because of BC [backward compatibility] breaks )

注意:

许多包都有一个legacy 分支 ...例如一个2.1.x 分支来支持symfony/symfony 2.1.

Many bundles have a legacy branch ... for example a 2.1.x branch to support symfony/symfony 2.1.

在盲目地将整个项目更新到根包的新版本之前,请在 packagist 上查找这些分支!

Look for these branches on packagist prior to blindly updating your whole project to a new version of the root package!

提示:

通常,如果 composer 无法获取依赖项,这通常与您所需软件包之一的最低稳定性有关.所有包的最低稳定性通常默认为 stable.

Generally if composer fails to fetch a dependency this is often related to the minimum stability for one of your required packages. minimum stability of all packages normally defaults to stable.

解决方案:

smarttech 为 white-october/pagerfanta-bundle 使用了错误的分支 (dev-master) 以将其与 symfony 2.1 一起使用.2.1 的 正确分支 应该是:

smarttech used the wrong branch (dev-master) for white-october/pagerfanta-bundle to use it with symfony 2.1. The correct branch for 2.1 would have been:

"white-october/pagerfanta-bundle": "2.1.*@dev"

... @dev 稳定性标志告诉作曲家为这个单一包使用 dev 版本的学说扩展包.请阅读更多关于 composer 的 稳定性标志的信息.

... where the @dev stability flag tells composer to use the dev version of doctrine-extensions-bundle for this single package. Please read more about composer's Stability Flags.

快速浏览一下稳定性层次结构:

dev < alpha < beta < rc < stable

替代方案:

解决问题的另一种方法是设置 composer 的 最低稳定性一个>.

Another way to solve the issue would have been setting composer's minimum stability.

虽然这是不推荐,因为它适用于所有约束,因此您将获得所有包的不稳定版本.

Though this is not recommended as it applies to all constraints and as a result you will get unstable versions of all packages.

{

    [...]
    "require" :

        [...]

    "minimum-stability" : "dev",

    [...]

}