我正在尝试使用Sonata Admin Bundle安装Symfony 2.2但是我从Composer收到以下错误:

时间:2013-03-22 10:25:54

标签: symfony-2.2

使用包信息加载composer存储库 更新依赖项(包括require-dev) 您的要求无法解析为可安装的软件包。

问题1 - 在任何版本中找不到请求的包sonata-project / admin-bundle,包名中可能有拼写错误。 问题2 - 在任何版本中找不到请求的包sonata-project / doctrine-orm-admin-bundle,包名中可能存在拼写错误。 问题3 - 在任何版本中都找不到请求的包sonata-project / user-bundle,包名中可能有拼写错误。

code de 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.2.*",
        "doctrine/orm": "~2.2,>=2.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/admin-bundle": "*",
        "sonata-project/cache-bundle": "*",
        "sonata-project/doctrine-orm-admin-bundle": "*",
        "stof/doctrine-extensions-bundle": "1.1.x-dev",
        "sonata-project/user-bundle": "*",
        "sonata-project/easy-extends-bundle": "*",
        "friendsofsymfony/user-bundle": "*",
        "friendsofsymfony/jsrouting-bundle": "*",
        "liip/imagine-bundle": "*",
        "simplethings/form-extra-bundle": "dev-master",
        "antimattr/google-bundle": "dev-master",
        "doctrine/doctrine-fixtures-bundle": "dev-master",
        "genemu/form-bundle": "2.1.*",
        "behat/behat": "2.4.*@stable",
        "behat/mink": "1.4.*@stable",
        "behat/symfony2-extension": "*@stable",
        "behat/mink-extension": "*@stable",
        "behat/mink-selenium2-driver": "*@stable",
        "behat/mink-browserkit-driver": "*",
        "liip/functional-test-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": "alpha",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "branch-alias": {
        "dev-master": "2.2-dev"
    }
}

4 个答案:

答案 0 :(得分:4)

您需要指定'dev-master'并添加'Bock-Bundle'依赖项。

只需更改

"sonata-project/admin-bundle": "",

"sonata-project/block-bundle": "dev-master",
"sonata-project/admin-bundle": "dev-master",

答案 1 :(得分:1)

在你的composer.json中试试这个:

" sonata-project / admin-bundle":" dev-master",
" sonata-project / cache-bundle":" 2.1。",
" sonata-project / doctrine-orm-admin-bundle":" dev-master",
" knplabs / knp-menu-bundle":" 1.1。
-dev",
" sonata-project / block-bundle":" dev-master"

它对我有用。

答案 2 :(得分:0)

你没有看到“sonata-project / doctrine-orm-admin-bundle dev-master需要knplabs / knp-menu-bundle 1.1.x-dev”错误?

答案 3 :(得分:0)

在将Symfony 2.2与Sonata Admin Generator和FOS用户捆绑包一起使用时,我遇到了类似的问题。

以下是我在无休止的依赖相关头痛后创建的配置文件。 在此配置中使用“composer update”可以毫无问题地运行。


composer.json

....    
"require": {
            "php": ">=5.3.3",
            "symfony/symfony": "2.2.*",
            "doctrine/orm": "~2.2,>=2.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.*",
            "symfony/console": "2.2.*@dev",
            "doctrine/doctrine-fixtures-bundle": "dev-master",
            "doctrine/data-fixtures" : "dev-master",
            "friendsofsymfony/user-bundle": "*",
            "doctrine/doctrine-migrations-bundle": "dev-master",
            "doctrine/migrations": "dev-master",
            "sonata-project/admin-bundle": "dev-master",
            "sonata-project/doctrine-orm-admin-bundle": "dev-master",
            "sonata-project/intl-bundle": "2.1.*",
            "sonata-project/cache-bundle": "2.*",
            "sonata-project/block-bundle": "2.2.*@dev",
            "simplethings/entity-audit-bundle": "dev-master",
            "knplabs/knp-menu-bundle":"1.1.x-dev"
        },
....
  "minimum-stability": "alpha",

AppKernel.php

   public function registerBundles()
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
            new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
            new JMS\AopBundle\JMSAopBundle(),
            new JMS\DiExtraBundle\JMSDiExtraBundle($this),
            new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
            new FOS\UserBundle\FOSUserBundle(),
            new Sonata\BlockBundle\SonataBlockBundle(),
            new Sonata\jQueryBundle\SonatajQueryBundle(),
            new Sonata\AdminBundle\SonataAdminBundle(),
            new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
            new SimpleThings\EntityAudit\SimpleThingsEntityAuditBundle(),
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
        );

希望这有帮助!