drupal-composer/drupal-project

I get this error when I run ddev composer update

mikikuke opened this issue · 9 comments

DrupalProject\composer\ScriptHandler::checkComposerVersion
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 drupal/core-composer-scaffold 8.8 -> satisfiable by drupal/core-composer-scaffold[8.8.0].
    - drupal/core-composer-scaffold 8.8.0 requires composer-plugin-api ^1.0.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.

You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.
composer [update] failed, composer command failed: exit status 2. stderr=

how to fix this?

Either downgrade Composer or update your project.

composer update drupal/core drupal/core-* -W

Please post your composer.json if it doesn't work or close this issue if the above command fixed it for you.

{
    "name": "drupal-composer/drupal-project",
    "description": "Project template for Drupal 8 projects with composer",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "authors": [
        {
            "name": "",
            "role": ""
        }
    ],
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "php": ">=5.6",
        "composer/installers": "^1.2",
        "cweagans/composer-patches": "^1.6.5",
        "drupal/adaptivetheme": "^3.1",
        "drupal/address": "^1.6",
        "drupal/addtoany": "^1.12",
        "drupal/admin_toolbar": "^3.0",
        "drupal/advagg": "^3.5",
        "drupal/at_tools": "^3.2",
        "drupal/backup_migrate": "^4.0",
        "drupal/checklistapi": "^2.0",
        "drupal/ckeditor_youtube": "^1.1",
        "drupal/commerce": "^2.13",
        "drupal/console": "^1.0.2",
        "drupal/core": "^8.6.0",
        "drupal/core-composer-scaffold": "8.8",
        "drupal/htaccess": "2.x-dev",
        "drupal/imce": "^1.7",
        "drupal/inline_entity_form": "^1.0@RC",
        "drupal/linkit": "5.0.*@dev",
        "drupal/ludwig": "^1.0",
        "drupal/metatag": "^1.8",
        "drupal/pathauto": "^1.4",
        "drupal/profile": "^1.0@RC",
        "drupal/redirect": "^1.3",
        "drupal/seo_checklist": "^5.0",
        "drupal/simple_sitemap": "^3.1",
        "drupal/sitemap": "^1.5",
        "drupal/state_machine": "^1.0@RC",
        "drupal/stringoverrides": "1.x-dev",
        "drupal/token": "^1.5",
        "drupal/upgrade_status": "3.0",
        "drupal/views_bulk_operations": "^3.13",
        "drupal/views_slideshow": "^4.6",
        "drupal/webform": "5.26",
        "drush/drush": "^9.7",
        "vlucas/phpdotenv": "^2.4",
        "webflo/drupal-finder": "^1.0.0",
        "webmozart/path-util": "^2.3",
        "zaporylie/composer-drupal-optimizations": "^1.0"
    },
    "require-dev": {
        "webflo/drupal-core-require-dev": "^8.6.0"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "sort-packages": true
    },
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ],
        "files": ["load.environment.php"]
    },
    "scripts": {
        "pre-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "pre-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "post-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ],
        "post-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ]
    },
    "extra": {
        "composer-exit-on-patch-failure": true,
        "patchLevel": {
            "drupal/core": "-p2"
        },
        "installer-paths": {
            "web/core": ["type:drupal-core"],
            "web/libraries/{$name}": ["type:drupal-library"],
            "web/modules/contrib/{$name}": ["type:drupal-module"],
            "web/profiles/contrib/{$name}": ["type:drupal-profile"],
            "web/themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/Commands/{$name}": ["type:drupal-drush"]
        },
        "drupal-scaffold": {
            "initial": {
                ".editorconfig": "../.editorconfig",
                ".gitattributes": "../.gitattributes"
            }
        }
    }
}

also why is my "webflo/drupal-core-require-dev": "^8.6.0" and not 8.9?

I want to use the best composer version, I have heard there is composer recommended version outthere...so which one to use?

When you go to https://github.com/webflo/drupal-core-require-dev you see:

DEPRECATED – DO NOT USE

Your composer.json is pretty old. Refurbish it and make it look more like the latest 8.x composer.json: https://github.com/drupal-composer/drupal-project/blob/8.x/composer.json and better also update the scripts/composer/ScriptHandler.php.

Hi, I ran the command and I get an error

ddev composer update drupal/core drupal/core-* -W


  [Symfony\Component\Console\Exception\RuntimeException]
  The "-W" option does not exist.


update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...

composer [

update drupal/core drupal/core-* -W] failed, composer command failed: exit status 1. stderr=

The command won't help anyways because your composer.json is completely out of date. ddev composer update drupal/core 'webflo/drupal-*' drupal/console zaporylie/composer-drupal-optimizations composer/installers cweagans/composer-patches vlucas/phpdotenv --with-dependencies might eventually work, but you need to make yourself familiar with it.

so your command will fix my composer.json so no need to manually update it?

No, it's just a workaround. You will need to make yourself familiar with it. If all fails, downgrade Composer inside DDEV again. ddev stop && ddev config --composer-version=1 --project-type=drupal8 && ddev start. But this is also just a workaround. You need to manually fix your composer.json as suggested above. You need to find out how to properly update Composer dependencies, maybe you get the idea from the commands I already gave you.

Maybe try your luck in one of the support channels at https://drupal.slack.com/. There's room for back and forth conversations.