我无法使用Composer安装stof/doctrine-extensions-bundle
。我正在使用Symfony2.1.9版本,并显示了很多问题。第一个是:
无法找到所请求的软件包stof / doctrine-extensions-bundle 1.1。*。
这是我的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"
时
回复是:your requirement could not be resolved to an installable set of package
可能是什么问题? 我应该先安装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].
答案 0 :(得分:9)
这里的关键部分如下:
[...]
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 [向后兼容性]中断而导致代码损坏)
<强>注意:强>
许多捆绑包都有旧版分支 ...例如 2.1.x分支,以支持 symfony / symfony 2.1。
在盲目地将整个项目更新为新版本的根软件包之前,在packagist上查找这些分支!
提示强>:
通常,如果composer无法获取依赖项,则通常与您所需的某个包的最小稳定性相关。所有包的最低稳定性通常默认为稳定。
<强>解决方案:强>
smarttech使用 white-october / pagerfanta-bundle 的错误分支(dev-master)与symfony 2.1 一起使用。 2.1的正确分支应该是:
"white-october/pagerfanta-bundle": "2.1.*@dev"
...其中 @dev 稳定性标志告诉编写者使用此单个包的 dev 版本的doctrine-extensions-bundle。请阅读有关作曲家Stability Flags的更多信息。
快速查看稳定性层次结构:
dev < alpha < beta < rc < stable
<强>替代:强>
另一种解决问题的方法是设置作曲家的minimum stability。
虽然这是不推荐,因为它适用于所有约束,因此您将获得所有包的不稳定版本。
{
[...]
"require" :
[...]
"minimum-stability" : "dev",
[...]
}
答案 1 :(得分:0)
由于stof/doctrine-extensions-bundle的1.1.x分支仍然只能作为开发人员使用。所以你必须将它声明为作曲家中的dev依赖。简单地:
"stof/doctrine-extensions-bundle": "1.1.*@dev"
下次看看packagist,哪个版本可以使用所需的捆绑包。
编辑:是的,在新的symfony安装中测试了这个要求并且它可以工作。因此,如果您有错误,请在您的问题中编辑完整的错误消息!
答案 2 :(得分:0)
因为这是一个完全不同的答案。您的问题不是stof/doctrine-extensions-bundle
,而是white-october/pagerfanta-bundle
。孩子们,阅读错误信息!
我怎么知道这个?只需复制您的composer.json,执行更新并获得含义错误消息:
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].
这意味着,pagerfanta-bundle的实际版本需要symfony 2. 2 ,所以如果你想使用它,你必须升级。