我正在尝试从symfony 2.7升级到3.0。我让我的代码不被弃用,并根据这个版本用新的包版本更新了composer.json
。当我用命令composer update --with-dependencies symfony/symfony
开始升级时,它会给我以下错误:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package sensio/distribution-bundle == 4.0.4.0 could not be found.
Problem 2
- The requested package sensio/generator-bundle == 2.5.3.0 could not be found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
我不知道这两个包裹的这些奇怪版本是从哪里来的。我的composer.json
看起来像:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The "Symfony Standard Edition" distribution",
"autoload": {
"psr-0": { "": "src/", "SymfonyStandard": "app/" }
},
"require": {
"php": ">=5.5.9",
"symfony/symfony": "3.0.*",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.8",
"sensio/distribution-bundle": "~5.0",
"sensio/framework-extra-bundle": "~3.0.2",
"incenteev/composer-parameter-handler": "~2.0"
},
"require-dev": {
"sensio/generator-bundle": "~3.0"
},
"scripts": {
"post-root-package-install": [
"SymfonyStandard\Composer::hookRootPackageInstall"
],
"post-install-cmd": [
"Incenteev\ParameterHandler\ScriptHandler::buildParameters",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::removeSymfonyStandardFiles"
],
"post-update-cmd": [
"Incenteev\ParameterHandler\ScriptHandler::buildParameters",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::removeSymfonyStandardFiles"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "3.0-dev"
},
"symfony-assets-install": "symlink"
}
}
我看不出我在哪里犯了错,有什么建议吗?
编辑:
只执行composer update
而不是composer update --with-dependencies symfony/symfony
似乎解决了问题,所有包都成功更新,之后显示:
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
Fatal error: Class 'SymfonyComponentConsoleInputArgvInput' not found in /home/wombat/htdocs/gugupanel/app/console on line 17
这里有一个composer.json,它几乎与您的匹配,对我有效。
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The "Symfony Standard Edition" distribution",
"autoload": {
"psr-4": { "": "src/" },
"files": [ "app/AppKernel.php" ]
},
"autoload-dev": {
"psr-4": { "Tests\": "tests/" }
},
"require": {
"php": ">=5.5.9",
"symfony/symfony": "3.0.*",
"doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"symfony/swiftmailer-bundle": "^2.3",
"symfony/monolog-bundle": "^2.8",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0",
"phpunit/phpunit": "^4.8",
"sensio/generator-bundle": "^3.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^2.7"
},
"scripts": {
"post-install-cmd": [
"Incenteev\ParameterHandler\ScriptHandler::buildParameters",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget"
],
"post-update-cmd": [
"Incenteev\ParameterHandler\ScriptHandler::buildParameters",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget"
]
},
"extra": {
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "3.0-dev"
}
}
}
为了解决composer的这些问题,我建议您从composer.json中删除库,然后使用composer-require。
- 删除
"sensio/distribution-bundle": "~5.0"
依赖项 - 运行编写器更新
- 还是错误?对导致错误的其他库重复1和2
-
没有错误?现在您的作曲家需要您删除的库:
composer需要传感器/分发包
这样作曲家就会找到最适合你的。保持一个更稳定的composer json也很好!
不要忘记在所有更新完成后提交composer.lock
文件,这样其他开发人员将使用与您相同的版本。
希望它能有所帮助!