Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint. #8913

Closed
BonBonSlick opened this issue May 18, 2020 · 6 comments

Comments

@BonBonSlick
Copy link

BonBonSlick commented May 18, 2020

Multiple projects use different versions of packages and composer-plugin-api as a result.
AFter trying to require package for older project got this error

Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
composer install / update --no-plugins

 Problem 1
    - symfony/flex[v1.3.1, ..., v1.6.3] require composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
    - Root composer.json requires symfony/flex ^1.3.1 -> satisfiable by symfony/flex[v1.3.1, ..., v1.6.3].

You are using a snapshot build of Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report an issue to them to ask them to support Composer 2. To work around this you can run Composer with --ignore-platform-reqs, but this will also ignore your PHP version and may result in bigger problems down the line.

composer self-update makes no sense because some of the packages are outdated and it is installed globally.
composer update --with-all-dependencies also gives not results.

Composer lock in older projects has requirements for plugin-api v 1.0 only.
The only suitable solution I see is installing different versions of the composer per project.
Of course, downgrading is also an option
composer self-update 1.*.* but newer projects may suffer :)

My composer.json:

{
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "^7.1.3",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "ext-json": "*",
        "cron/cron-bundle": "^2.4",
        "drenso/phan-extensions": "^2.5",
        "friendsofsymfony/rest-bundle": "^2.7",
        "nelmio/api-doc-bundle": "^3.5",
        "nelmio/cors-bundle": "^2.0",
        "phan/phan": "^2.5",
        "ramsey/uuid": "^3.9",
        "sensio/framework-extra-bundle": "^5.5",
        "symfony/browser-kit": "4.4.*",
        "symfony/console": "4.4.*",
        "symfony/dotenv": "4.4.*",
        "symfony/flex": "^1.3.1",
        "symfony/framework-bundle": "4.4.*",
        "symfony/http-client": "4.4.*",
        "symfony/lock": "4.4.*",
        "symfony/monolog-bundle": "^3.5",
        "symfony/options-resolver": "4.4.*",
        "symfony/orm-pack": "^1.0",
        "symfony/security-bundle": "4.4.*",
        "symfony/serializer": "4.4.*",
        "symfony/serializer-pack": "^1.0",
        "symfony/validator": "4.4.*",
        "symfony/yaml": "4.4.*"
    },
    "require-dev": {
        "ext-json": "*",
        "dama/doctrine-test-bundle": "^6.3",
        "doctrine/doctrine-fixtures-bundle": "^3.3",
        "phpdocumentor/reflection-docblock": "^4.0",
        "phpunit/phpunit": "^8.5",
        "roave/security-advisories": "dev-master",
        "symfony/maker-bundle": "^1.14",
        "symfony/phpunit-bridge": "^5.0"
    },
    "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.*"
        }
    }
}

Output of composer diagnose:

Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: OK
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 2.0-dev+106289e5dc5b9c0fa459fba28a99ea888f5a51b6
PHP version: 7.2.30
PHP binary path: /usr/bin/php7.2
OpenSSL version: OpenSSL 1.1.1d  10 Sep 2019

When I run this command:

composer install / update --no-pluigns

I get the following output:

  Problem 1
    - symfony/flex[v1.3.1, ..., v1.6.3] require composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.

Removing vendors folder and composer.lock, then

 composer update
// output
The "symfony/flex" plugin was skipped because it requires a Plugin API version ("^1.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.
The "ocramius/package-versions" plugin was skipped because it requires a Plugin API version ("^1.0.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.
... // same Problem 1

And I expected this to happen:
Packages are updated or installed.

Is there other than mentioned solutions?

@stof
Copy link
Contributor

stof commented May 18, 2020

Well, the plugin ecosystem is not yet fully compatible with the upcoming Composer 2.0. There is #8726 to track this

@BonBonSlick
Copy link
Author

@stof thanks!

@Dsantacruz
Copy link

I've install composer 1.4.1 , with this worked for me.

@danishlaeeq
Copy link

Use this command to downgrade composer to 1.0
composer self-update --1
It Worked for me having the same issue

@BernardA
Copy link

BernardA commented May 7, 2022

At this time, running composer self-update --2 will install version 2.3.5 that does not throw the error.

@uaoleg
Copy link

uaoleg commented Jun 17, 2022

Still not working, though composer 2 is now a default version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants