作曲家显示 2 个兼容包(原始包)之间的冲突



我在尝试composer install我的依赖项时出错。与composer update相同的错误。

它说symfony/web-server-bundle 4.3.3和symfony 3.4之间存在冲突,但这些包应该是兼容的:

  • https://github.com/symfony/web-server-bundle/blob/4.3/composer.json
  • https://packagist.org/packages/symfony/web-server-bundle

这是我的控制台输出:

$ composer install --ignore-platform-reqs
Deprecation warning: Your package name theredled/. is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match "[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*". Make sure you fix this as Composer 2.0 will error.
Deprecation warning: require.beberlei/DoctrineExtensions is invalid, it should not contain uppercase characters. Please use beberlei/doctrineextensions instead. Make sure you fix this as Composer 2.0 will error.
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for symfony/symfony v3.4.30 -> satisfiable by symfony/symfony[v3.4.30].
- don't install symfony/web-server-bundle v4.3.3|don't install symfony/symfony v3.4.30
- Installation request for symfony/web-server-bundle v4.3.3 -> satisfiable by symfony/web-server-bundle[v4.3.3].

这是我的作曲家.json:

{
"name": "theredled/.",
"license": "proprietary",
"type": "project",
"autoload": {
"psr-4": {
"": "src/"
},
"classmap": [
"app/AppKernel.php",
"app/AppCache.php"
]
},
"autoload-dev": {
"psr-4": {
"App\Tests\": "tests/"
}
},
"require": {
"php": ">=7.1.0",
"symfony/symfony": "3.4.*",
"doctrine/orm": "~2.6",
"doctrine/doctrine-bundle": "~1.9",
"symfony/swiftmailer-bundle": "~3.2",
"symfony/monolog-bundle": "~3.3",
"sensio/distribution-bundle": "~5.0",
"incenteev/composer-parameter-handler": "~2.1",
"twig/extensions": "^1.5",
"liip/imagine-bundle": "^2.1",
"spe/filesize-extension-bundle": "~1.0.0",
"doctrine/doctrine-migrations-bundle": "^1.3",
"beberlei/DoctrineExtensions": "^1.1",
"excelwebzone/recaptcha-bundle": "^1.5",
"knplabs/knp-snappy-bundle": "^1.5",
"knplabs/knp-paginator-bundle": "^2.8",
"debesha/doctrine-hydration-profiler-bundle": "^1.3",
"xmon/color-picker-type-bundle": "^1.0",
"symfony/assetic-bundle": "^2.8",
"symfony/console": "~3.4",
"eightpoints/guzzle-bundle": "^7.4",
"symfony/webpack-encore-bundle": "^1.6",
"sentry/sentry-symfony": "^2.1",
"cocur/slugify": "^3.2"
},
"require-dev": {
"sensio/generator-bundle": "~3.0",
"symfony/browser-kit": "^4.3",
"symfony/css-selector": "^4.3",
"symfony/phpunit-bridge": "^4.3",
"onurb/doctrine-yuml-bundle": "1.1.5",
"phpunit/php-code-coverage": "^6.1",
"hautelook/alice-bundle": "^2.5",
"doctrine/data-fixtures": "^1.3",
"symfony/web-server-bundle": "^4.3"
},
"scripts": {
"post-install-cmd": [
"Incenteev\ParameterHandler\ScriptHandler::buildParameters",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget"
],
"post-update-cmd": [
"Incenteev\ParameterHandler\ScriptHandler::buildParameters",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget"
]
},
"config": {
"bin-dir": "bin",
"platform": {
"php": "7.1.11"
}
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"symfony": {
"allow-contrib": "true"
}
}
}

知道吗?

正如我最近在另一个答案中所描述的那样,您确实会收到此错误消息,因为symfony/symfony充当完全相同版本的symfony/web-server-bundle的替代品,因为以下行:https://github.com/symfony/symfony/blob/3.4/composer.json#L85

作曲家文档准确地告诉你这一点,并以Symfony为例来解释replace部分:

这对于包含子包的包也很有用,对于 示例主 Symfony/Symfony 包包含所有 Symfony 组件也可作为单独的软件包提供。如果你 需要主包,它将自动满足任何要求 其中一个单独的组件,因为它替换了它们。

资料来源:https://getcomposer.org/doc/04-schema.md#replace

因此,就目前composer.json而言,您正在指示作曲家在版本4.3.3上安装symfony/web-server-bundle并在版本3.4.30上安装symfony/web-server-bundle(通过请求在版本3.4.30上安装symfony/symfony,这说明它替换了该包(,而作曲家最终处于不兼容状态, 正如错误所解释的那样,同时安装两个不同版本的软件包。

- don't install symfony/web-server-bundle v4.3.3|don't install symfony/symfony v3.4.30
- Installation request for symfony/web-server-bundle v4.3.3 -> satisfiable by symfony/web-server-bundle[v4.3.3].

=>不要安装symfony/web-server-bundle就是它的真正含义:你实际上不需要它,它已经是symfony/symfony的一部分

从这里您有三种选择:

  1. 您删除了composer.json中对symfony/web-server-bundle的要求(但这意味着您必须按照symfony/symfony提供的版本3.4.30使用该软件包(
  2. 您将symfony/symfony包升级到4.3.3(仍然将symfony/web-server-bundle的要求排除在composer.json之外,因为symfony/symfony确实会替换它(。
  3. 您需要一个接一个地需要的symfony/*包,但不是通过"超级包"symfony/symfony
    。从长远来看,这是更多的工作和更多可能的不兼容性,但这是在版本^4.0中仍然具有其他Symfony软件包时symfony/web-server-bundle的唯一方法^3.0
    这方面的一个例子是替换composer.json的这一行:

    "symfony/symfony": "3.4.*",
    

    "symfony/asset": "3.4.*",
    "symfony/browser-kit": "3.4.*",
    "symfony/cache": "3.4.*",
    "symfony/class-loader": "3.4.*",
    "symfony/config": "3.4.*",
    "symfony/console": "3.4.*",
    "symfony/css-selector": "3.4.*",
    "symfony/dependency-injection": "3.4.*",
    "symfony/debug": "3.4.*",
    "symfony/debug-bundle": "3.4.*",
    "symfony/doctrine-bridge": "3.4.*",
    "symfony/dom-crawler": "3.4.*",
    "symfony/dotenv": "3.4.*",
    "symfony/event-dispatcher": "3.4.*",
    "symfony/expression-language": "3.4.*",
    "symfony/filesystem": "3.4.*",
    "symfony/finder": "3.4.*",
    "symfony/form": "3.4.*",
    "symfony/framework-bundle": "3.4.*",
    "symfony/http-foundation": "3.4.*",
    "symfony/http-kernel": "3.4.*",
    "symfony/inflector": "3.4.*",
    "symfony/intl": "3.4.*",
    "symfony/ldap": "3.4.*",
    "symfony/lock": "3.4.*",
    "symfony/monolog-bridge": "3.4.*",
    "symfony/options-resolver": "3.4.*",
    "symfony/process": "3.4.*",
    "symfony/property-access": "3.4.*",
    "symfony/property-info": "3.4.*",
    "symfony/proxy-manager-bridge": "3.4.*",
    "symfony/routing": "3.4.*",
    "symfony/security": "3.4.*",
    "symfony/security-core": "3.4.*",
    "symfony/security-csrf": "3.4.*",
    "symfony/security-guard": "3.4.*",
    "symfony/security-http": "3.4.*",
    "symfony/security-bundle": "3.4.*",
    "symfony/serializer": "3.4.*",
    "symfony/stopwatch": "3.4.*",
    "symfony/templating": "3.4.*",
    "symfony/translation": "3.4.*",
    "symfony/twig-bridge": "3.4.*",
    "symfony/twig-bundle": "3.4.*",
    "symfony/validator": "3.4.*",
    "symfony/var-dumper": "3.4.*",
    "symfony/web-link": "3.4.*",
    "symfony/web-profiler-bundle": "3.4.*",
    "symfony/workflow": "3.4.*",
    "symfony/yaml": "3.4.*"
    

    我刚刚通过复制symfony/symfonycomposer.jsonreplace部分来创建的,其中我用您的实际symfony/symfony版本替换了"self.version",最后,删除了软件包symfony/web-server-bundle,因为您已经在另一个版本上需要它。

至于你对symfony/web-server-bundlercomposer.json的误解,这个包确实与列出的Symfony版本^4.0的包兼容:

  • symfony/config
  • Symfony/console
  • symfony/dependency-injection
  • symfony/http-kernel
  • Symfony/Polyfill-ctype
  • symfony/process

不是捆绑的"超级包"symfony/symfony,这确实不存在于其composer.json的要求部分中

相关内容

  • 没有找到相关文章

最新更新