composer.json fails to resolve installable set of package

后端 未结 3 1391
春和景丽
春和景丽 2021-01-01 06:17

I can\'t install stof/doctrine-extensions-bundle with my Composer. I\'m using Symfony2.1.9 version and a lot of problems are shown. The first one is:

相关标签:
3条回答
  • 2021-01-01 07:07

    The critical part in here is the following:

    [...]
    white-october/pagerfanta-bundle dev-master requires symfony/framework-bundle >=2.2,<3.0 -> satisfiable by symfony/symfony[v2.2.0, v2.2.1], symfony/framework-bundle[v2.2.0, v2.2.1].
    [...]
    

    Which can lead to confusion! Let me explain:

    Though it says the dependency is satisfiable by updating symfony/symfony to 2.2.0 or 2.2.1 ... this update is NOT NEEDED !! ( even if updating might be a good idea it is not necessary to resolve the issue and could lead to broken code because of BC [backward compatibility] breaks )

    Attention:

    Many bundles have a legacy branch ... for example a 2.1.x branch to support symfony/symfony 2.1.

    Look for these branches on packagist prior to blindly updating your whole project to a new version of the root package!

    Tip:

    Generally if composer fails to fetch a dependency this is often related to the minimum stability for one of your required packages. minimum stability of all packages normally defaults to stable.

    Solution:

    smarttech used the wrong branch (dev-master) for white-october/pagerfanta-bundle to use it with symfony 2.1. The correct branch for 2.1 would have been:

    "white-october/pagerfanta-bundle": "2.1.*@dev"
    

    ... where the @dev stability flag tells composer to use the dev version of doctrine-extensions-bundle for this single package. Please read more about composer's Stability Flags.

    Take a quick look at the stability hierarchy:

    dev < alpha < beta < rc < stable
    

    Alternative:

    Another way to solve the issue would have been setting composer's minimum stability.

    Though this is not recommended as it applies to all constraints and as a result you will get unstable versions of all packages.

    {
    
        [...]
        "require" :
    
            [...]
    
        "minimum-stability" : "dev",
    
        [...]
    
    }
    
    0 讨论(0)
  • 2021-01-01 07:10

    As the 1.1.x branch of the stof/doctrine-extensions-bundle is still only available as dev. So you have to declare it as a dev dependency in composer. Simply:

    "stof/doctrine-extensions-bundle": "1.1.*@dev"
    

    Next time take a look at packagist, which versions are available of a desired bundle.

    EDIT: And yes, tested this requirement in a fresh symfony install and it works. So if you have errors, edit the complete error message in your question!

    0 讨论(0)
  • 2021-01-01 07:14

    As this is a completly different answer. Your problem is not stof/doctrine-extensions-bundle, it's white-october/pagerfanta-bundle. Kids, read the error messages!

    How i knew this? Simply copied your composer.json, executed update and got a meaning error message:

     white-october/pagerfanta-bundle dev-master requires symfony/framework-bundle >=2.2,<3.0 -> satisfiable by symfony/symfony[v2.2.0, v2.2.1], symfony/framework-bundle[v2.2.0, v2.2.1].
    

    which means, actual versions of pagerfanta-bundle requires symfony 2.2, so you have to upgrade, if you want to use it.

    0 讨论(0)
提交回复
热议问题