Issue to install EasyAdmin with composer in Symfony 5

Viewed 2257

I started a new project in Symfony 5 and i tried to install EasyAdmin with composer require easycorp/easyadmin-bundle but I found an issue.

Composer log :

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "5.1.*"
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install easycorp/easyadmin-bundle v3.1.3
    - Conclusion: don't install easycorp/easyadmin-bundle v3.1.2
    - Conclusion: don't install easycorp/easyadmin-bundle v3.1.1
    - Conclusion: don't install easycorp/easyadmin-bundle v3.1.0
    - Conclusion: don't install easycorp/easyadmin-bundle v3.0.2
    - Conclusion: don't install easycorp/easyadmin-bundle v3.0.1
    - Conclusion: remove doctrine/common 3.0.2
    - Installation request for easycorp/easyadmin-bundle ^3.0 -> satisfiable by easycorp/easyadmin-bundle[v3.0.0, v3.0.1, v3.0.2, v3.1.0, v3.1.1, v3.1.2, v3.1.3].
    - Conclusion: don't install doctrine/common 3.0.2
    - easycorp/easyadmin-bundle v3.0.0 requires doctrine/common ^2.8 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.8.0, v2.8.1, v2.9.0].
    - Can only install one of: doctrine/common[2.12.0, 3.0.2].
    - Can only install one of: doctrine/common[2.13.0, 3.0.2].
    - Can only install one of: doctrine/common[2.13.1, 3.0.2].
    - Can only install one of: doctrine/common[2.13.2, 3.0.2].
    - Can only install one of: doctrine/common[2.13.3, 3.0.2].
    - Can only install one of: doctrine/common[v2.11.0, 3.0.2].
    - Can only install one of: doctrine/common[v2.10.0, 3.0.2].
    - Can only install one of: doctrine/common[v2.8.0, 3.0.2].
    - Can only install one of: doctrine/common[v2.8.1, 3.0.2].
    - Can only install one of: doctrine/common[v2.9.0, 3.0.2].
    - Installation request for doctrine/common (locked at 3.0.2) -> satisfiable by doctrine/common[3.0.2].

Do you have an idea to resolve it ?

4 Answers

Easyadmin has a dependency on doctrine/common v2 you need to remove your current doctrine version with composer remove doctrine/common then you can install easyadmin

Try change your composer.json file like this:

    "type": "project",
    "license": "proprietary",
    "require": {
        "php": ">=7.2.5",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "composer/package-versions-deprecated": "^1.11",
        "doctrine/annotations": "^1.10",
        "doctrine/doctrine-bundle": "^2.1",
        "doctrine/doctrine-migrations-bundle": "^3.0",
        "doctrine/orm": "^2.6.3",
    "easycorp/easyadmin-bundle": "3.1",
        "sensio/framework-extra-bundle": "^5.6",
        "symfony/asset": "5.1.*",
        "symfony/console": "5.1.*",
        "symfony/dotenv": "5.1.*",
        "symfony/flex": "^1.3.1",
        "symfony/form": "5.1.*",
        "symfony/framework-bundle": "5.1.*",
        "symfony/maker-bundle": "^1.20",
        "symfony/security-bundle": "5.1.*",
        "symfony/stopwatch": "5.1.*",
        "symfony/twig-bundle": "5.1.*",
        "symfony/validator": "5.1.*",
        "symfony/web-profiler-bundle": "5.1.*",
        "symfony/yaml": "5.1.*",
        "twig/extra-bundle": "^2.12|^3.0",
        "twig/twig": "^2.12|^3.0"
    },


and then type: sudo composer update. Works on Ubuntu 18.04 LTS :)

As you can see in that list of error messages: easycorp/easyadmin-bundle requires doctrine/common in v2, while you have already installed v3.

You should downgrade that package such that the admin bundle can be installed. If you need help with that, please add the content of composer.json to your question.

You need to downgrade doctrine/common and doctrine/persistence.

Try this:

composer require doctrine/persistence:1.3.8 doctrine/common:2.13.3

Then you should be able to call:

symfony composer req "admin:^2.0"

Related