因此,在 Symfony2 上安装 Sonata Admin Bundle 后,我在尝试让作曲家再次工作时遇到了问题。使用命令php composer.phar ....
时,我收到以下错误消息:[UnexpectedValueException] Could not parse version constraint composer.phar: Invalid version string "composer.phar"
我对作曲家做了什么动作并不重要,它总是会产生那个错误。好吧,一个例外是php composer.phar require --no-update sonata-project/media-bundle
它更新了 composer.json 没有错误消息,但实际上并没有安装任何东西。
到目前为止,我刚刚删除并重新安装了带有更新版本的 composer.phar。我在带有 MAMP 和 PHP 5.4.4 的 Mac OS 10.7.5 上运行 Symfony 2.2.1-dev。不确定这是否相关,但我也无法再使用清除缓存php app/console cache:clear
。我必须通过 Finder 删除缓存。
这是我的 composer.json 文件以防万一:
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": "composer.phar",
"symfony/symfony": "2.2.*",
"doctrine/orm": "2.3.*",
"doctrine/doctrine-bundle": "1.2.*",
"twig/extensions": "1.0.*",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.2.*",
"symfony/monolog-bundle": "2.2.*",
"sensio/distribution-bundle": "2.2.*",
"sensio/framework-extra-bundle": "2.2.*",
"sensio/generator-bundle": "2.2.*",
"jms/security-extra-bundle": "1.4.*",
"jms/di-extra-bundle": "1.3.*",
"sonata-project/cache-bundle": "dev-master",
"sonata-project/block-bundle": "dev-master",
"sonata-project/jquery-bundle": "1.8.*",
"knplabs/knp-menu-bundle": "1.1.*-dev",
"sonata-project/exporter": "1.1.*",
"sonata-project/admin-bundle": "dev-master",
"sonata-project/doctrine-orm-admin-bundle": "dev-master",
"doctrine/common": "2.3.x-dev",
"sonata-project/media-bundle": "dev-master"
},
"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"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "dev",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"branch-alias": {
"dev-master": "2.2-dev"
}
}
任何帮助/建议都会很棒:)