gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 09:01:15 29 4
gpt4 key购买 nike

我无法使用 Composer 安装 stof/doctrine-extensions-bundle。我使用的是 Symfony2.1.9 版本,出现了很多问题。第一个是:

the requested package stof/doctrine-extensions-bundle 1.1.* could not be found.

这是我的 composer.json 文件:

{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
"doctrine/orm": ">=2.2.3,<2.5-dev",
"doctrine/doctrine-bundle": "1.1.*",
"twig/extensions": "1.0.*@dev",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.1.*",
"symfony/monolog-bundle": "2.1.*",
"sensio/distribution-bundle": "2.1.*",
"sensio/framework-extra-bundle": "2.1.*",
"sensio/generator-bundle": "2.1.*",
"jms/security-extra-bundle": "1.2.*",
"jms/di-extra-bundle": "1.1.*",
"kriswallsmith/assetic": "1.1.*@dev",
"pagerfanta/pagerfanta": "dev-master",
"white-october/pagerfanta-bundle": "dev-master",
"friendsofsymfony/user-bundle": "dev-master",
"saad-tazi/g-chart-bundle": "dev-master",
"stof/doctrine-extensions-bundle": "1.1.*",
},
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"branch-alias": {
"dev-master": "2.1-dev"
}
}
}

当我将包要求设置为:"stof/doctrine-extensions-bundle": "1.1.*@dev"响应是:您的要求无法解析为一组可安装的软件包

请问可能是什么问题?我应该先安装 DoctrineExtensions 吗????

错误信息:

Problem 1
- Conclusion: don't install symfony/symfony v2.1.10
- Conclusion: remove symfony/symfony v2.1.9
- Conclusion: don't install symfony/symfony v2.1.9
- Conclusion: don't install symfony/symfony v2.1.8
- Conclusion: don't install symfony/symfony v2.1.7
- Conclusion: don't install symfony/symfony v2.1.6
- Conclusion: don't install symfony/symfony v2.1.5
- Conclusion: don't install symfony/symfony v2.1.4
- Conclusion: don't install symfony/symfony v2.1.3
- Conclusion: don't install symfony/symfony v2.1.2
- Conclusion: don't install symfony/symfony v2.1.1
- 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].
- 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].
- Can only install one of: symfony/symfony[v2.2.0, v2.1.0].
- Can only install one of: symfony/symfony[v2.2.1, v2.1.0].
- don't install symfony/framework-bundle v2.2.0|don't install symfony/symfony v2.1.0
- don't install symfony/framework-bundle v2.2.1|don't install symfony/symfony v2.1.0
- Installation request for symfony/symfony 2.1.* -> satisfiable by symfony/symfony[v2.1.0, v2.1.1, v2.1.10, v2.1.2, v2.1.3, v2.1.4, v2.1.5, v2.1.6, v2.1.7,v2.1.8, v2.1.9].
- Installation request for white-october/pagerfanta-bundle dev-master -> satisfiable by white-october/pagerfanta-bundle[dev-master].

最佳答案

这里的关键部分如下:

[...]
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].
[...]

这会导致困惑!让我解释一下:

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

注意:

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

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

提示:

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

解决方案:

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

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

... @dev 稳定性标志告诉 Composer 为这个单一包使用 dev 版本的学说扩展包。请阅读更多关于 Composer 的 Stability Flags .

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

dev < alpha < beta < rc < stable

替代方案:

解决问题的另一种方法是设置 Composer 的 minimum stability .

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

{

[...]
"require" :

[...]

"minimum-stability" : "dev",

[...]

}

关于symfony - composer.json 无法解析可安装的软件包集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16672993/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com