這看起來像一個簡單的問題,但我無法解釋發生了什麼。Composer爲什麼安裝似乎與要求衝突的軟件包版本?
在我的Symfony項目的composer.json
中,樹枝版本被指定爲< 2.0,以避免破壞v1和v2之間的變化。但是,Composer無論如何安裝最新的Twig版本(2.4.3)。
php c:\php\composer\composer.phar depends -t "twig/twig"
twig/twig v2.4.3 Twig, the flexible, fast, and secure template language for PHP
|--symfony/framework-standard-edition dev-develop (requires twig/twig <2.0)
|--symfony/symfony v2.8.24 (requires twig/twig ~1.34|~2.4)
| `--symfony/framework-standard-edition dev-develop (requires symfony/symfony 2.8.*)
`--twig/extensions v1.5.1 (requires twig/twig ~1.27|~2.0)
`--symfony/framework-standard-edition dev-develop (requires twig/extensions ^1.3)
composer.json的相關大塊:
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.8.*",
"doctrine/dbal": "2.5.*",
"doctrine/orm": "2.5.*",
"doctrine/doctrine-bundle": "~1.2",
"twig/twig": "<2.0",
"twig/extensions": "^1.3",
etc
}
在我看來像symfony/symfony
和twig/extensions
包裝的要求,與項目相結合,會造成最高可能1。 x版本的Twig,1.34.4,但這不是什麼情況。爲什麼?
編輯:
作曲家1.4.2
完全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.3.3",
"symfony/symfony": "2.8.*",
"doctrine/dbal": "2.5.*",
"doctrine/orm": "2.5.*",
"doctrine/doctrine-bundle": "~1.2",
"twig/twig": "<2.0",
"twig/extensions": "^1.3",
"symfony/assetic-bundle": "^2.8",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"beberlei/DoctrineExtensions": "^1.0",
"royopa/fpdf-symfony2": "^1.0",
"liuggio/excelbundle": "^2.0",
"patchwork/jsqueeze": "^2.0",
"leafo/scssphp": "^0.6.5",
"doctrine/doctrine-migrations-bundle": "^1.0",
"ocramius/proxy-manager": "~2.0.0",
"aws/aws-sdk-php-symfony": "^1.2"
},
"require-dev": {
"sensio/generator-bundle": "~2.3",
"symfony/phpunit-bridge": "^3.1",
"deployer/deployer": "^3.3"
},
"scripts": {
"post-root-package-install": [
"SymfonyStandard\\Composer::hookRootPackageInstall"
],
"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",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles"
],
"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",
"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": "2.5-dev"
}
}
}
編輯2:
刪除composer.lock完全更新並重新安裝給了我什麼,我想我應該得到!
感謝您的期待,剛更新了更多信息。將嘗試一個完整的包重新安裝 – frumious
我不得不刪除這個包:「ocramius /代理經理」:「〜2.0.0」,因爲它需要PHP 7,並沒有在我的機器上工作。 但除此之外,安裝工作正常,安裝的樹枝包仍然是正確的:1.34.4(2017-07-04) – sw0rdfishhhhh
再次感謝 - 我已經完成了整個刷新,現在我得到1.34 .4也是!所以不知道爲什麼會發生這種情況,特別是爲什麼「depends」命令可以給出兩個不同的答案,而不會改變任何直接相關的信息!我會把它寫成一個怪癖,繼續前進。乾杯! – frumious