1

我是 Symfony2 和 composer.phar 安装包的新手。

每次我想安装一个新的捆绑包时,我都会遇到错误。我不知道是我的 composer.json 坏了还是我完整安装了 Symfony

# php composer.phar require friendsofsymfony/comment-bundle
Please provide a version constraint for the friendsofsymfony/comment-bundle requirement: dev-master
composer.json has been updated
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove symfony/symfony 2.1.x-dev
    - Can only install one of: symfony/symfony dev-master, symfony/symfony 2.1.x-dev.
    - Can only install one of: symfony/symfony 2.2.x-dev, symfony/symfony 2.1.x-dev.
    - don't install symfony/class-loader dev-master|don't install symfony/symfony 2.1.x-dev
    - Installation request for symfony/symfony == 2.1.9999999.9999999-dev -> satisfiable by symfony/symfony 2.1.x-dev.
    - Installation request for symfony/class-loader dev-master -> satisfiable by symfony/class-loader dev-master, symfony/symfony dev-master, symfony/symfony 2.2.x-dev.

作曲家是否试图告诉我我需要再次安装 symfony ?

这是我的 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.4-dev",
        "doctrine/doctrine-bundle": "1.0.*",
        "twig/extensions": "1.0.*",
        "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.*",
        "symfony/class-loader": "dev-master",
        "friendsofsymfony/comment-bundle": "dev-master",
        "knplabs/knp-paginator-bundle": "dev-master",
        "facebook/php-sdk": "dev-master",
        "friendsofsymfony/facebook-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"
    }
}

编辑:由于这些错误,我不得不手动安装捆绑包(例如 FOSFacebookBundle),所以我不得不更新 vendor/composer/autoload_namespaces.php(是的,我知道这很糟糕)

EDIT2:当我执行 composer.phar 更新

# php composer.phar update
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove symfony/symfony 2.1.x-dev
    - Conclusion: don't install symfony/symfony 2.1.x-dev
    - 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
    - Conclusion: don't install symfony/symfony v2.1.0
    - Conclusion: don't install symfony/symfony v2.1.0-RC2
    - Conclusion: don't install symfony/symfony v2.1.0-RC1
    - Conclusion: don't install symfony/symfony v2.1.0-BETA4
    - Installation request for friendsofsymfony/facebook-bundle dev-master -> satisfiable by friendsofsymfony/facebook-bundle dev-master.
    - Conclusion: don't install symfony/symfony v2.1.0-BETA3
    - Installation request for symfony/class-loader dev-master -> satisfiable by symfony/class-loader dev-master, symfony/symfony dev-master, symfony/symfony 2.2.x-dev.
    - Conclusion: don't install symfony/symfony v2.1.0-BETA2
    - friendsofsymfony/facebook-bundle dev-master requires symfony/twig-bundle >=2.1,<2.3-dev -> satisfiable by symfony/symfony 2.1.x-dev, symfony/symfony 2.1.x-dev, symfony/symfony 2.2.x-dev, symfony/symfony v2.1.0, symfony/symfony v2.1.1, symfony/symfony v2.1.2, symfony/symfony v2.1.3, symfony/symfony v2.1.4, symfony/twig-bundle 2.1.x-dev, symfony/twig-bundle 2.2.x-dev, symfony/twig-bundle v2.1.0, symfony/twig-bundle v2.1.1, symfony/twig-bundle v2.1.2, symfony/twig-bundle v2.1.3, symfony/twig-bundle v2.1.4.
    - Can only install one of: symfony/symfony v2.1.0-BETA1, symfony/symfony 2.2.x-dev.
    - don't install symfony/twig-bundle 2.1.x-dev|don't install symfony/symfony v2.1.0-BETA1
    - don't install symfony/twig-bundle 2.2.x-dev|don't install symfony/symfony v2.1.0-BETA1
    - don't install symfony/twig-bundle v2.1.0|don't install symfony/symfony v2.1.0-BETA1
    - don't install symfony/twig-bundle v2.1.1|don't install symfony/symfony v2.1.0-BETA1
    - don't install symfony/twig-bundle v2.1.2|don't install symfony/symfony v2.1.0-BETA1
    - don't install symfony/twig-bundle v2.1.3|don't install symfony/symfony v2.1.0-BETA1
    - don't install symfony/twig-bundle v2.1.4|don't install symfony/symfony v2.1.0-BETA1
    - Installation request for symfony/symfony 2.1.* -> satisfiable by symfony/symfony 2.1.x-dev, symfony/symfony v2.1.0, symfony/symfony v2.1.0-BETA1, symfony/symfony v2.1.0-BETA2, symfony/symfony v2.1.0-BETA3, symfony/symfony v2.1.0-BETA4, symfony/symfony v2.1.0-RC1, symfony/symfony v2.1.0-RC2, symfony/symfony v2.1.1, symfony/symfony v2.1.2, symfony/symfony v2.1.3, symfony/symfony v2.1.4.

谢谢你的帮助。

4

1 回答 1

1

找到了答案!

尽管看起来很简单(不适合我),但依赖于symfony/class-loader没有引用正确的版本。

所以我所要做的就是删除类加载器,一切都很好。

于 2012-12-06T14:12:41.083 回答