尝试使用 composer 将 sylius/product-bundle 安装到我的 Symfony 5.3 项目时出现问题
Issues trying to install sylius/product-bundle to my Symfony 5.3 project with composer
我正在尝试开发一个项目,但在安装带有 composer 的 Sylius 时遇到问题。
这是我的 composer.json
{
"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
时出现此错误
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 尝试获取 sylius/product-bundle
的 0.15.0
版本,这显然不适用于我的配置,因为它需要旧版本的依赖项,如下所示.
仅当我尝试使用 composer require sylius/product-bundle:1.9.4
要求更新版本时,我也会收到错误消息
[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
,这又一次给我一个错误,但是另一个错误
./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
你有两个问题:
- 您安装了一天前刚刚发布的 Symfony“5.3”。
- 您正在使用 PHP 8,Sylius 不支持它。通过使用 PHP 8,您最终会安装与 Sylius 不兼容的依赖项版本。
由于当前版本的 Sylius supports up to 5.2 和 PHP ^7.3,您必须降级到 Sf 5.2 和 PHP >= 7.3 && PHP < 8,或者等待一段时间,以便支持 Sf 5.3 和 PHP >= 8 被烘焙。
我建议使用标准的 Sylius 安装,但在使用 PHP 8 时尝试使用推荐的文档方式 (composer create-project sylius/sylius-standard acme
) 安装 Sylius 也会失败。但降级为
PHP 7.4 和 运行 create-project
命令确实有效。
项目似乎进入了开发的依赖地狱阶段。
我正在尝试开发一个项目,但在安装带有 composer 的 Sylius 时遇到问题。
这是我的 composer.json
{
"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
时出现此错误
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 尝试获取 sylius/product-bundle
的 0.15.0
版本,这显然不适用于我的配置,因为它需要旧版本的依赖项,如下所示.
仅当我尝试使用 composer require sylius/product-bundle:1.9.4
要求更新版本时,我也会收到错误消息
[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
,这又一次给我一个错误,但是另一个错误
./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
你有两个问题:
- 您安装了一天前刚刚发布的 Symfony“5.3”。
- 您正在使用 PHP 8,Sylius 不支持它。通过使用 PHP 8,您最终会安装与 Sylius 不兼容的依赖项版本。
由于当前版本的 Sylius supports up to 5.2 和 PHP ^7.3,您必须降级到 Sf 5.2 和 PHP >= 7.3 && PHP < 8,或者等待一段时间,以便支持 Sf 5.3 和 PHP >= 8 被烘焙。
我建议使用标准的 Sylius 安装,但在使用 PHP 8 时尝试使用推荐的文档方式 (composer create-project sylius/sylius-standard acme
) 安装 Sylius 也会失败。但降级为
PHP 7.4 和 运行 create-project
命令确实有效。
项目似乎进入了开发的依赖地狱阶段。