Composer更新成功,但是在创建的锁定文件上Composer安装失败 [英] Composer Update succeeds but Composer Install fails on created lock file

查看:159
本文介绍了Composer更新成功,但是在创建的锁定文件上Composer安装失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在symfony 3.4.30安装上进行作曲家更新时,它会毫无问题地完成,但是当我尝试在创建的锁定文件上运行作曲家安装时,会引发错误。

When I do a composer update on my symfony 3.4.30 installation, it completes without problem, but when I try running composer install on the created lock file, it throws an error.

这同时在我的CentOS服务器和MacOS笔记本电脑上发生。我安装了最新的作曲家:

This happens both on my CentOS server, and my MacOS laptop. I have the latest composer installed:

有人知道发生了什么吗?

Anyone know what is going on?

我尝试完全删除供应商目录,以及composer.lock文件均未成功。我还更新了作曲家的版本,并清除了作曲家的缓存:

I have tried completely removing the vendor directory, and the composer.lock file with no success. I have also updated my composer version, and also cleared my composer cache:

composer clearcache
Cache directory does not exist (cache-vcs-dir):
Clearing cache (cache-repo-dir): /home/<user>/.composer/cache/repo
Clearing cache (cache-files-dir): /home/<user>/.composer/cache/files
Clearing cache (cache-dir): /home/<user>/.composer/cache
All caches cleared.

composer --version
Composer version 1.9.0 2019-08-02 20:55:32



php -dmemory_limit=-1 /usr/bin/composer.phar update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 63 installs, 0 updates, 0 removals
  - Installing doctrine/cache (v1.8.0): Downloading (100%)
  - Installing doctrine/inflector (v1.3.0): Downloading (100%)
  - Installing paragonie/random_compat (v2.0.18): Downloading (100%)
  - Installing symfony/polyfill-php70 (v1.12.0): Downloading (100%)
  - Installing symfony/polyfill-util (v1.12.0): Downloading (100%)
  - Installing symfony/polyfill-php56 (v1.12.0): Downloading (100%)
  - Installing symfony/polyfill-mbstring (v1.12.0): Downloading (100%)
  - Installing symfony/symfony (v3.4.30): Downloading (100%)
  - Installing symfony/polyfill-intl-icu (v1.12.0): Downloading (100%)
  - Installing symfony/polyfill-ctype (v1.12.0): Downloading (100%)
  - Installing symfony/polyfill-apcu (v1.12.0): Downloading (100%)
  - Installing psr/simple-cache (1.0.1): Downloading (100%)
  - Installing psr/log (1.1.0): Downloading (100%)
  - Installing psr/link (1.0.0): Downloading (100%)
  - Installing psr/container (1.0.0): Downloading (100%)
  - Installing psr/cache (1.0.1): Downloading (100%)
  - Installing twig/twig (v2.11.3): Downloading (100%)
  - Installing fig/link-util (1.0.0): Downloading (100%)
  - Installing doctrine/lexer (1.0.2): Downloading (100%)
  - Installing doctrine/annotations (v1.7.0): Downloading (100%)
  - Installing doctrine/reflection (v1.0.0): Downloading (100%)
  - Installing doctrine/event-manager (v1.0.0): Downloading (100%)
  - Installing doctrine/collections (v1.6.2): Downloading (100%)
  - Installing doctrine/persistence (1.1.1): Downloading (100%)
  - Installing doctrine/common (v2.10.0): Downloading (100%)
  - Installing doctrine/doctrine-cache-bundle (1.3.5): Downloading (100%)
  - Installing symfony/polyfill-php73 (v1.12.0): Downloading (100%)
  - Installing symfony/polyfill-php72 (v1.12.0): Downloading (100%)
  - Installing symfony/polyfill-intl-idn (v1.12.0): Downloading (100%)
  - Installing symfony/mime (v4.3.3): Downloading (100%)
  - Installing jdorn/sql-formatter (v1.2.17): Downloading (100%)
  - Installing doctrine/dbal (v2.9.2): Downloading (100%)
  - Installing doctrine/doctrine-bundle (1.11.2): Downloading (100%)
  - Installing symfony/templating (v4.3.3): Downloading (100%)
  - Installing friendsofsymfony/user-bundle (v2.1.2): Downloading (100%)
  - Installing incenteev/composer-parameter-handler (v2.1.3): Downloading (100%)
  - Installing symfony/http-client-contracts (v1.1.5): Downloading (100%)
  - Installing symfony/http-client (v4.3.3): Downloading (100%)
  - Installing sensiolabs/security-checker (v6.0.2): Downloading (100%)
  - Installing sensio/distribution-bundle (v5.0.25): Downloading (100%)
  - Installing sensio/framework-extra-bundle (v5.4.1): Downloading (100%)
  - Installing monolog/monolog (1.24.0): Downloading (100%)
  - Installing symfony/monolog-bundle (v3.4.0): Downloading (100%)
  - Installing swiftmailer/swiftmailer (v5.4.12): Downloading (100%)
  - Installing symfony/swiftmailer-bundle (v2.6.7): Downloading (100%)
  - Installing guzzlehttp/promises (v1.3.1): Downloading (100%)
  - Installing ralouphie/getallheaders (3.0.3): Downloading (100%)
  - Installing psr/http-message (1.0.1): Downloading (100%)
  - Installing guzzlehttp/psr7 (1.6.1): Downloading (100%)
  - Installing guzzlehttp/guzzle (6.3.3): Downloading (100%)
  - Installing sendgrid/php-http-client (3.9.6): Downloading (100%)
  - Installing sendgrid/sendgrid (7.3.0): Downloading (100%)
  - Installing google/recaptcha (1.2.2): Downloading (100%)
  - Installing excelwebzone/recaptcha-bundle (v1.5.15): Downloading (100%)
  - Installing sensio/generator-bundle (v3.1.7): Downloading (100%)
  - Installing symfony/phpunit-bridge (v3.4.30): Downloading (100%)
  - Installing fzaninotto/faker (v1.8.0): Downloading (100%)
  - Installing hamcrest/hamcrest-php (v2.0.0): Downloading (100%)
  - Installing mockery/mockery (1.2.3): Downloading (100%)
  - Installing doctrine/instantiator (1.2.0): Downloading (100%)
  - Installing doctrine/orm (v2.6.3): Downloading (100%)
  - Installing steevanb/doctrine-stats (1.3.3): Downloading (100%)
  - Installing steevanb/php-backtrace (2.0.1): Downloading (100%
Writing lock file
Generating autoload files
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache



composer install
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
    - Conclusion: remove friendsofsymfony/user-bundle v2.1.2
    - Installation request for friendsofsymfony/user-bundle v2.1.2 -> satisfiable by friendsofsymfony/user-bundle[v2.1.2].
    - Conclusion: remove symfony/symfony v3.4.30
    - friendsofsymfony/user-bundle v2.1.2 requires symfony/templating ^2.8 || ^3.0 || ^4.0 -> satisfiable by symfony/templating[v4.3.3].
    - don't install symfony/symfony v3.4.30|remove symfony/templating v4.3.3
    - don't install symfony/templating v4.3.3|don't install symfony/symfony v3.4.30
    - Installation request for symfony/symfony v3.4.30 -> satisfiable by symfony/symfony[v3.4.30].

这是我的composer.json:

Here is my composer.json:

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-4": {
            "AppBundle\\": "src/AppBundle"
        },
        "classmap": [
            "app/AppKernel.php",
            "app/AppCache.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        },
        "files": [
            "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
        ]
    },
    "require": {
        "php": ">=7.1.18",
        "doctrine/doctrine-bundle": "^1.6",
        "doctrine/orm": "^2.5",
        "friendsofsymfony/user-bundle": "^2.0",
        "incenteev/composer-parameter-handler": "^2.0",
        "sensio/distribution-bundle": "^5.0.19",
        "sensio/framework-extra-bundle": "^5.0.0",
        "symfony/monolog-bundle": "^3.1.0",
        "symfony/polyfill-apcu": "^1.0",
        "symfony/swiftmailer-bundle": "^2.6.4",
        "symfony/symfony": "^3.0",
        "twig/twig": "^1.0||^2.0",
        "guzzlehttp/guzzle": "^6.3",
        "symfony/templating": "^4.1",
        "sendgrid/sendgrid": "~7",
        "excelwebzone/recaptcha-bundle": "~1.5",
        "paragonie/random_compat": "^2.0"
    },
    "require-dev": {
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^3.0",
        "fzaninotto/faker": "~1.2",
        "mockery/mockery": "~1.1",
        "steevanb/doctrine-stats": "^1.3",
        "steevanb/php-backtrace": "^2.0"
    },
    "scripts": {
        "symfony-scripts": [
            "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-install-cmd": [
            "@symfony-scripts"
        ],
        "post-update-cmd": [
            "@symfony-scripts"
        ]
    },
    "config": {
        "platform": {
            "php": "7.1.18"
        },
        "sort-packages": true
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-bin-dir": "bin",
        "symfony-var-dir": "var",
        "symfony-web-dir": "web",
        "symfony-tests-dir": "tests",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "3.4-dev"
        }
    }
}


推荐答案

TL; DR;



您要解决的方法是删除行

TL;DR;

Your way to fix it is to drop the line

"symfony/templating": "^4.1",

从您的 composer.json ,然后重试整个过程。

From your composer.json, and retry the whole thing.

请记住,它将把您的 symfony / templing 版本降级到 3.4.x 并可能导致副作用。

Mind that it will downgrade your symfony/templating version to 3.4.x and might cause you side effects.

为什么? 好吧,您的问题实际上出在这里:symfony / symfony的composer.json行:> https://github.com/symfony/symfony/blob/3.4/composer.json#L77

Why? Well, your issue is actually coming from here: that line of the composer.json of symfony/symfony: https://github.com/symfony/symfony/blob/3.4/composer.json#L77

并由 https://getcomposer.org/doc/04-schema.md#replace

事实上,当您安装 symfony / symfony 时,在相同版本中替换 symfony / tempulation (因此,在您的情况下为 3.4.30 ),但随后,您在 composer.json 中也有说明,以将其安装为版本 ^ 4.3

So, as a matter of fact, when you install symfony/symfony, it acts as a replacement of symfony/templating at the same version (so 3.4.30, in your case) but then, you also have the instruction in your composer.json to install it at the version ^4.3

这些行也告诉您:

- don't install symfony/symfony v3.4.30|remove symfony/templating v4.3.3
- don't install symfony/templating v4.3.3|don't install symfony/symfony v3.4.30

它实际上指示您安装 symfony / symfony v3.4.30 symfony /模板v4。 3.3 但不能同时使用,因为 replace 指令> package使它与 symfony / templating 完全相同,但在您的情况下,不是同一版本。

It actually instruct you to either install symfony/symfony v3.4.30 OR symfony/templating v4.3.3 but not both at the same time, because the replace instruction of the symfony/symfony package make it the exact same package as symfony/templating, but not in the same version in your case.

实际上,作曲家的文档也确实告诉您:

And actually the composer documentation tells you exactly that too:


这对于包含子软件包(对于$ b $)的软件包也很有用。 b示例中,主要的symfony / symfony软件包包含所有Symfony
组件,这些组件也可以作为单独的软件包使用。如果您
需要主软件包,它将自动满足单个组件之一的任何要求
,因为它将替换它们。

This is also useful for packages that contain sub-packages, for example the main symfony/symfony package contains all the Symfony Components which are also available as individual packages. If you require the main package it will automatically fulfill any requirement of one of the individual components, since it replaces them.

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

这篇关于Composer更新成功,但是在创建的锁定文件上Composer安装失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆