0

I have a build, with the following constraint on drupal/core, for some reason the constraint is not respected.

Upon running composer install this comes up:

 - Downloading drupal/core (9.5.0-rc1)

Composer show -i drupal/core:

name     : drupal/core
descrip. : Drupal is an open source content management platform powering millions of websites and applications.
keywords :
versions : * 9.5.0-rc1

I seriously would prefer having stable drupal/core. I am able to "force the universe" by doing composer require drupal/core --update-with-dependencies, and committing the generated .lock file.

Why, composer, why?!?

composer.json:

{
    "name": "acme/drupal",
    "description": "Acquia-compatible Drupal application based on the Drupal Recommended Project",
    "license": "GPL-2.0-or-later",
    "authors": [
        {
            "name": "Acquia Engineering",
            "homepage": "https://www.acquia.com",
            "role": "Maintainer"
        }
    ],
    "repositories": {
        "asset-packagist": {
            "type": "composer",
            "url": "https://asset-packagist.org"
        },
        "drupal": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    },
    "require": {
        "php": ">=8.1",
        "acquia/acquia-cms-starterkit": "^1",
        "acquia/blt": "^13.5",
        "acquia/drupal-environment-detector": "^1",
        "acquia/http-hmac-php": "6.0.0",
        "acquia/memcache-settings": "^1",
        "composer/installers": "^2.1",
        "cweagans/composer-patches": "^1.6",
        "drupal/address": "^1.11",
        "drupal/admin_toolbar": "^3.1",
        "drupal/coffee": "^1.2",
        "drupal/config_ignore": "^2.3",
        "drupal/config_readonly": "^1.0@beta",
        "drupal/config_split": "^1.9",
        "drupal/core": "~9.4",
        "drupal/core-composer-scaffold": "^9",
        "drupal/core-recommended": "~9.4",
        "drupal/drimage": "^2.0",
        "drupal/entity_browser": "^2.8",
        "drupal/entity_clone": "^1.0@beta",
        "drupal/field_group": "^3.2",
        "drupal/focal_point": "^1.5",
        "drupal/fpa": "^3.0",
        "drupal/gin": "^3.0@beta",
        "drupal/insert": "^1.0",
        "drupal/link_attributes": "^1.11",
        "drupal/module_filter": "^3.2",
        "drupal/paragraphs": "^1.15",
        "drupal/pathauto": "^1.11",
        "drupal/scheduler": "^1.4",
        "drupal/seckit": "^2.0",
        "drupal/section_library": "^1.0",
        "drupal/section_library_reusable": "^1.0@beta",
        "drupal/shield": "^1.6",
        "drupal/twig_tweak": "^3.1",
        "drupal/upgrade_status": "^3.13",
        "drupal/webprofiler": "^9.0",
        "drush/drush": "^10.6 || ^11",
        "oomphinc/composer-installers-extender": "^1.1 || ^2"
    },
    "require-dev": {
        "acquia/blt-phpcs": "^1.0",
        "acquia/coding-standards": "^1.0.0",
        "behat/behat": "^3.11",
        "behat/mink": "^1.10",
        "drupal/devel": "^4.1",
        "drupal/drupal-extension": "^4.2",
        "drupal/twig_vardumper": "^3.0",
        "mglaman/phpstan-drupal": "^1.1",
        "phpspec/prophecy-phpunit": "^2.0",
        "phpstan/extension-installer": "^1.1",
        "phpstan/phpstan": "^1.6",
        "phpstan/phpstan-deprecation-rules": "^1.0",
        "phpunit/phpunit": "^9.5",
        "squizlabs/php_codesniffer": "^3.6"
    },
    "config": {
        "allow-plugins": {
            "composer/installers": true,
            "cweagans/composer-patches": true,
            "dealerdirect/phpcodesniffer-composer-installer": true,
            "drupal/core-composer-scaffold": true,
            "ergebnis/composer-normalize": true,
            "oomphinc/composer-installers-extender": true,
            "phpstan/extension-installer": true,
            "acquia/blt": true,
            "acquia/blt-phpcs": true,
            "drupal/console-extend-plugin": true
        },
        "platform": {
            "php": "8.1"
        },
        "sort-packages": true
    },
    "extra": {
        "composer-exit-on-patch-failure": true,
        "drupal-scaffold": {
            "allowed-packages": [
                "acquia/acquia_cms"
            ],
            "file-mapping": {
                "[profile-root]/.editorconfig": false,
                "[profile-root]/.gitattributes": false,
                "[profile-root]/.travis.yml": false,
                "[profile-root]/acquia-pipelines.yml": false,
                "[web-root]/sites/default/default.services.yml": {
                    "mode": "replace",
                    "overwrite": false,
                    "path": "docroot/core/assets/scaffold/files/default.services.yml"
                },
                "[web-root]/sites/default/default.settings.php": {
                    "mode": "replace",
                    "overwrite": false,
                    "path": "docroot/core/assets/scaffold/files/default.settings.php"
                }
            },
            "gitignore": true,
            "locations": {
                "profile-root": "docroot/profiles/contrib/acquia_cms",
                "web-root": "docroot/"
            }
        },
        "enable-patching": true,
        "installer-paths": {
            "docroot/core": [
                "type:drupal-core"
            ],
            "docroot/libraries/{$name}": [
                "type:drupal-library",
                "type:bower-asset",
                "type:npm-asset"
            ],
            "docroot/modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "docroot/modules/custom/{$name}": [
                "type:drupal-custom-module"
            ],
            "docroot/profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "docroot/themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "docroot/themes/custom/{$name}": [
                "type:drupal-custom-theme"
            ],
            "drush/Commands/contrib/{$name}": [
                "type:drupal-drush"
            ]
        },
        "installer-types": [
            "bower-asset",
            "npm-asset"
        ],
        "patchLevel": {
            "drupal/core": "-p2"
        },
        "patches": {
            "drupal/core": {
                "Break long text strings in layout edit": "https://www.drupal.org/files/issues/2020-12-22/3016507-50.patch",
                "Improve StringItem::generateSampleValue()": "https://www.drupal.org/files/issues/2020-06-24/3091478-15.patch",
                "Not all form elements can't use in vertical_tabs": "https://www.drupal.org/files/issues/2021-01-02/3122920_group_patch_5.patch",
                "PHP message: Error: Call to a member function getEntityTypeId() on null (Layout Builder)": "https://www.drupal.org/files/issues/2020-08-05/3049332-inline-35.patch",
                "Stream wrapper reference in JS library causes error in _locale_parse_js_file()": "https://www.drupal.org/files/issues/2020-05-08/2735717-28.patch",
                "New non translatable field on translatable content throws error": "https://www.drupal.org/files/issues/2021-02-10/3025039_42.patch"
            },
            "drupal/section_library": {
                "#3228163: Add create or update logic.": "https://git.drupalcode.org/project/section_library/-/merge_requests/3.patch"
            }
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "acms:install": [
            "./vendor/bin/acms acms:install"
        ],
        "nuke": [
            "rm -rf docroot vendor composer.lock"
        ]
    }
}
3
  • You have tilde constraints and “minimum-stability": "dev".
    – cilefen
    Nov 18 at 1:17
  • I’m voting to close this question because it is a question about Composer usage, and not truly specific to Drupal. I understand if others disagree.
    – cilefen
    Nov 18 at 1:33
  • @cilefen Thanks mate, I totally understand your point but this is a grey area... as the installation and setup of the app requires knowledge of this component. Nov 18 at 15:54

1 Answer 1

3
  1. Set "minimum-stability": "stable".
  2. Remove drupal/core from composer.json requirements section. It is superfluous.
  3. composer require drupal/core-recommended:^9.4 drupal/core-composer-scaffold:^9.4 -W.

Once you do that you have more work to do because of things that don't make sense, like drupal/insert 1.0.0 requires drupal/core ^8. If that is removed you have:

 Root composer.json requires drupal/gin ^3.0@beta -> satisfiable by drupal/gin[3.0.0-beta1, ..., 3.0.0-beta5].
    - drupal/gin[3.0.0-beta1, ..., 3.0.0-beta5] require drupal/gin_toolbar ^1.0@beta -> found drupal/gin_toolbar[dev-1.x, 1.0.0-alpha1, ..., 1.x-dev (alias of dev-1.x)] but it does not match your minimum-stability.

When that happens you have to specify dev versions of the dependencies explicitly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.