首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >试图用composer将sylius/product安装到我的Symfony 5.3项目的问题

试图用composer将sylius/product安装到我的Symfony 5.3项目的问题
EN

Stack Overflow用户
提问于 2021-06-03 13:58:21
回答 1查看 862关注 0票数 1

我正在尝试开发一个项目,我在用composer安装Sylius时遇到了困难。

这是我的composer.json

代码语言:javascript
复制
{
    "type": "project",
    "license": "proprietary",
    "minimum-stability": "dev",
    "prefer-stable": true,
    "require": {
        "php": ">=7.0",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "composer/package-versions-deprecated": "1.11.99.2",
        "doctrine/annotations": "^1.0",
        "doctrine/doctrine-bundle": "^2.4",
        "doctrine/doctrine-migrations-bundle": "^3.1",
        "doctrine/orm": "^2.9",
        "phpdocumentor/reflection-docblock": "^5.2",
        "sensio/framework-extra-bundle": "^6.1",
        "symfony/apache-pack": "^1.0",
        "symfony/asset": "5.3.*",
        "symfony/console": "5.3.*",
        "symfony/dotenv": "5.3.*",
        "symfony/expression-language": "5.3.*",
        "symfony/flex": "^1.3.1",
        "symfony/form": "5.3.*",
        "symfony/framework-bundle": "5.3.*",
        "symfony/http-client": "5.3.*",
        "symfony/intl": "5.3.*",
        "symfony/mailer": "5.3.*",
        "symfony/mime": "5.3.*",
        "symfony/monolog-bundle": "^3.1",
        "symfony/notifier": "5.3.*",
        "symfony/process": "5.3.*",
        "symfony/property-access": "5.3.*",
        "symfony/property-info": "5.3.*",
        "symfony/proxy-manager-bridge": "5.3.*",
        "symfony/runtime": "5.3.*",
        "symfony/security-bundle": "5.3.*",
        "symfony/serializer": "5.3.*",
        "symfony/string": "5.3.*",
        "symfony/translation": "5.3.*",
        "symfony/twig-bundle": "^5.3",
        "symfony/validator": "5.3.*",
        "symfony/web-link": "5.3.*",
        "symfony/webpack-encore-bundle": "^1.11",
        "symfony/yaml": "5.3.*",
        "twig/extra-bundle": "^2.12|^3.0",
        "twig/twig": "^2.12|^3.0"
    },
    "require-dev": {
        "phpunit/phpunit": "^9.5",
        "symfony/browser-kit": "^5.3",
        "symfony/css-selector": "^5.3",
        "symfony/debug-bundle": "^5.3",
        "symfony/maker-bundle": "^1.0",
        "symfony/phpunit-bridge": "^5.3",
        "symfony/stopwatch": "^5.3",
        "symfony/var-dumper": "^5.3",
        "symfony/web-profiler-bundle": "^5.3"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*"
    },
    "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": "5.3.*"
        }
    }
}

当我输入composer require sylius/product-bundle时,我会得到这个错误

代码语言:javascript
复制
Using version ^0.15.0 for sylius/product-bundle
./composer.json has been updated
Running composer update sylius/product-bundle
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires sylius/product-bundle ^0.15.0 -> satisfiable by sylius/product-bundle[v0.15.0].
    - sylius/product-bundle v0.15.0 requires symfony/framework-bundle ~2.3 -> found symfony/framework-bundle[v2.3.0, ..., 2.8.x-dev] but it conflicts with your root composer.json require (5.3.*).

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

因此,据我所知,composer试图获取版本0.15.0 of sylius/product-bundle,它显然无法使用我的配置,因为它需要更老版本的依赖项,如下所示。

只有当我尝试使用composer require sylius/product-bundle:1.9.4要求更新版本时,我才会得到一个错误

代码语言:javascript
复制
  [InvalidArgumentException]
  Package sylius/product-bundle at version 1.9.4 has a PHP requirement incompatible with your PHP version, PHP extensions and Composer version

考虑到所需的依赖项的版本,这个应该已经完成了。

我最终尝试了composer require sylius/product-bundle:1.9.4 --ignore-platform-reqs,这再次给了我一个错误,但却给出了另一个错误

代码语言:javascript
复制
./composer.json has been updated
Running composer update sylius/product-bundle
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "5.3.*"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - gedmo/doctrine-extensions[v2.3.10, ..., v2.4.x-dev, v3.0.0-beta, ..., v3.0.1] require doctrine/common ~2.4 -> found doctrine/common[2.4.0-RC1, ..., 2.13.x-dev] but the package is fixed to 3.1.2 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - gedmo/doctrine-extensions[v2.3.4, ..., v2.3.9] require doctrine/common >=2.2,<2.5-dev -> found doctrine/common[2.2.0BETA1, ..., 2.4.x-dev] but the package is fixed to 3.1.2 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - gedmo/doctrine-extensions[v3.0.0-beta2, ..., v3.0.5] require doctrine/cache ^1.0 -> found doctrine/cache[v1.0, ..., 1.11.x-dev] but the package is fixed to 2.0.3 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - sylius/product-bundle v1.9.4 requires stof/doctrine-extensions-bundle ^1.4 -> satisfiable by stof/doctrine-extensions-bundle[v1.4.0, v1.5.0, v1.6.0, 1.6.x-dev (alias of dev-master)].
    - stof/doctrine-extensions-bundle 1.6.x-dev is an alias of stof/doctrine-extensions-bundle dev-master and thus requires it to be installed too.
    - stof/doctrine-extensions-bundle v1.4.0 requires gedmo/doctrine-extensions ^2.3.4 -> satisfiable by gedmo/doctrine-extensions[v2.3.4, ..., v2.4.x-dev].
    - stof/doctrine-extensions-bundle[dev-master, v1.5.0, ..., v1.6.0] require gedmo/doctrine-extensions ^2.3.4 || ^3.0.0 -> satisfiable by gedmo/doctrine-extensions[v2.3.4, ..., v2.4.x-dev, v3.0.0-beta, ..., v3.0.5].
    - Root composer.json requires sylius/product-bundle 1.9.4 -> satisfiable by sylius/product-bundle[v1.9.4].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

我得到了PHP cli v8.0.6,Composer v2.0.12和Symfony cli v4.25.2

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-06-03 15:00:44

你有两个问题:

  • 您已经安装了Symfony '5.3‘,它是在一天前发布的。
  • 您使用的是PHP 8,Sylius不支持它。通过使用PHP 8,您将最终安装与Sylius不兼容的依赖项版本。

由于当前版本的Sylius 最多支持5.2和PHP ^ 7.3,您将不得不降级到SF5.2和PHP5.2和PHP7.3 && 最多支持5.2& is;8,或者等待一段时间,以便支持SF5.3和PHP 8。

我建议使用标准的Sylius安装,但是在使用PHP 8时尝试用推荐的docs (composer create-project sylius/sylius-standard acme)安装Sylius也会失败。但是,降级到PHP7.4并运行create-project命令确实有效。

这个项目似乎已经进入了依赖地狱的发展阶段。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67822865

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档