Sonata Admin for Symfony 4.4 无法安装 twig/twig 冲突

问题描述 投票:0回答:1

我运行新项目 Symfony 4.4

symfony new new_project --version=4.4

然后

composer require sonata-project/admin-bundle

并出现错误

composer require sonata-project/admin-bundle
Using version ^3.72 for sonata-project/admin-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.4.*"
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - sonata-project/admin-bundle 3.72.0 requires sonata-project/block-bundle ^3.20 -> satisfiable by sonata-project/block-bundle[3.20.0].
    - Installation request for sonata-project/admin-bundle ^3.72 -> satisfiable by sonata-project/admin-bundle[3.72.0].
    - Conclusion: remove twig/twig v3.0.4
    - Conclusion: don't install twig/twig v3.0.4
    - sonata-project/block-bundle 3.20.0 requires twig/twig ^2.12.1 -> satisfiable by twig/twig[v2.12.1, v2.12.2, v2.12.3, v2.12.4, v2.12.5, v2.13.0].
    - Can only install one of: twig/twig[v2.12.1, v3.0.4].
    - Can only install one of: twig/twig[v2.12.2, v3.0.4].
    - Can only install one of: twig/twig[v2.12.3, v3.0.4].
    - Can only install one of: twig/twig[v2.12.4, v3.0.4].
    - Can only install one of: twig/twig[v2.12.5, v3.0.4].
    - Can only install one of: twig/twig[v2.13.0, v3.0.4].
    - Installation request for twig/twig (locked at v3.0.4, required as ^2.12|^3.0) -> satisfiable by twig/twig[v3.0.4].

这里生成了composer.json

{
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "^7.1.3",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "composer/package-versions-deprecated": "^1.10",
        "doctrine/annotations": "^1.0",
        "doctrine/doctrine-bundle": "^2.1",
        "doctrine/doctrine-migrations-bundle": "^3.0",
        "doctrine/orm": "^2.7",
        "phpdocumentor/reflection-docblock": "^5.1",
        "sensio/framework-extra-bundle": "^5.1",
        "symfony/asset": "4.4.*",
        "symfony/console": "4.4.*",
        "symfony/dotenv": "4.4.*",
        "symfony/expression-language": "4.4.*",
        "symfony/flex": "^1.3.1",
        "symfony/form": "4.4.*",
        "symfony/framework-bundle": "4.4.*",
        "symfony/http-client": "4.4.*",
        "symfony/intl": "4.4.*",
        "symfony/mailer": "4.4.*",
        "symfony/messenger": "4.4.*",
        "symfony/monolog-bundle": "^3.1",
        "symfony/process": "4.4.*",
        "symfony/property-access": "4.4.*",
        "symfony/property-info": "4.4.*",
        "symfony/security-bundle": "4.4.*",
        "symfony/serializer": "4.4.*",
        "symfony/translation": "4.4.*",
        "symfony/twig-bundle": "4.4.*",
        "symfony/validator": "4.4.*",
        "symfony/web-link": "4.4.*",
        "symfony/yaml": "4.4.*",
        "twig/extra-bundle": "^2.12|^3.0",
        "twig/twig": "^2.12|^3.0"
    },
    "require-dev": {
        "symfony/browser-kit": "^4.4",
        "symfony/css-selector": "^4.4",
        "symfony/debug-bundle": "^4.4",
        "symfony/maker-bundle": "^1.0",
        "symfony/monolog-bundle": "^3.0",
        "symfony/phpunit-bridge": "^5.1",
        "symfony/stopwatch": "^4.4",
        "symfony/twig-bundle": "^4.4",
        "symfony/var-dumper": "^4.4",
        "symfony/web-profiler-bundle": "^4.4"
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "paragonie/random_compat": "2.*",
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "4.4.*"
        }
    }
}

兼容什么版本? 我应该更换哪个供应商来安装 sonata admin ?

symfony symfony4 sonata-admin
1个回答
1
投票

从该消息中可以看出:

sonata-project/block-bundle 3.20.0 需要 twig/twig ^2.12.1 -> 可满足 twig/twig[v2.12.1, v2.12.2, v2.12.3, v2.12.4, v2.12.5, v2.13.0 ].

因此您需要在 v2 中安装

twig/twig
- 目前已安装 v3。

此外,尝试使用更新版本的

sonata-project/block-bundle
- v4 与 Twig 3 兼容。

© www.soinside.com 2019 - 2024. All rights reserved.