0

I just created a new site and I cannot apply the patches with Composer in Drupal 8.9

Here is my composer.json file :

{
    "name": "drupal/recommended-project",
    "description": "Project template for Drupal 8 projects with a relocated document root",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "homepage": "https://www.drupal.org/project/drupal",
    "support": {
        "docs": "https://www.drupal.org/docs/user_guide/en/index.html",
        "chat": "https://www.drupal.org/node/314178"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "composer/installers": "^1.2",
        "drupal/advanced_pwa": "^1.2",
        "drupal/allowed_formats": "^1.3",
        "drupal/antibot": "^1.4",
        "drupal/bootstrap": "^3.23",
        "drupal/bootstrap_basic_image_gallery": "^1.4",
        "drupal/bootstrap_languages": "1.x-dev",
        "drupal/ckwordcount": "^1.1",
        "drupal/commerce": "^2.20",
        "drupal/commerce_checkout": "^2.20",
        "drupal/commerce_marketplace": "1.x-dev",
        "drupal/commerce_pos": "^2.5",
        "drupal/commerce_pricelist": "^2.0@RC",
        "drupal/commerce_recurring": "^1.0@beta",
        "drupal/commerce_reports": "^1.0@beta",
        "drupal/commerce_shipping": "^2.0@RC",
        "drupal/commerce_stock": "^1.0@alpha",
        "drupal/commerce_stripe": "^1.0@RC",
        "drupal/core-composer-scaffold": "^8.8",
        "drupal/core-project-message": "^8.8",
        "drupal/core-recommended": "^8.8",
        "drupal/diff": "^1.0",
        "drupal/entity": "^1.1",
        "drupal/entity_legal": "^3.0@beta",
        "drupal/entity_print": "^2.2",
        "drupal/entity_reference_revisions": "^1.8",
        "drupal/facets": "^1.5",
        "drupal/field_validation": "^1.0@alpha",
        "drupal/flag": "^4.0@beta",
        "drupal/flag_search_api": "^1.4",
        "drupal/flood_unblock": "^3.0",
        "drupal/form_mode_manager": "2.x-dev",
        "drupal/geolocation": "3.x-dev",
        "drupal/group": "^1.2",
        "drupal/image_delta_formatter": "^1.1",
        "drupal/image_widget_crop": "^2.3",
        "drupal/masquerade": "^2.0@beta",
        "drupal/message": "^1.0",
        "drupal/message_notify": "^1.1",
        "drupal/message_ui": "1.x-dev",
        "drupal/metatag": "^1.14",
        "drupal/office_hours": "^1.3",
        "drupal/paragraphs": "^1.12",
        "drupal/pathauto": "^1.8",
        "drupal/poll": "^1.4",
        "drupal/price_difference_formatter": "^1.2",
        "drupal/private_message": "2.x-dev",
        "drupal/private_message_flood": "^1.0@beta",
        "drupal/profile": "^1.1",
        "drupal/pwa": "^1.4",
        "drupal/redirect": "^1.6",
        "drupal/redirect_after_login": "^2.6",
        "drupal/schema_metatag": "^1.7",
        "drupal/search_api": "^1.17",
        "drupal/search_api_autocomplete": "^1.4",
        "drupal/search_api_location": "^1.0@alpha",
        "drupal/search_api_solr": "^4.1",
        "drupal/shariff": "^1.6",
        "drupal/simple_sitemap": "^3.7",
        "drupal/swiftmailer": "^2.0@beta",
        "drupal/token": "^1.7",
        "drupal/tour_ui": "^1.0@beta",
        "drupal/twig_tweak": "^2.6",
        "drupal/upgrade_status": "^2.9",
        "drupal/user_online_status": "^1.0",
        "drupal/views_block_filter_block": "^1.0",
        "drupal/views_bootstrap": "3.x-dev",
        "drupal/views_infinite_scroll": "^1.7",
        "drupal/viewsreference": "^1.4",
        "drupal/webform": "^6.0",
        "drupal/webform_views": "^5.0@alpha",
        "drupal/yoast_seo": "^2.0",
        "drush/drush": "^10.3"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "sort-packages": true
    },
    "extra": {
        "drupal-scaffold": {
            "locations": {
                "web-root": "web/"
            }
        },
        "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/contrib/{$name}": [
                "type:drupal-drush"
            ],
            "web/modules/custom/{$name}": [
                "type:drupal-custom-module"
            ],
            "web/themes/custom/{$name}": [
                "type:drupal-custom-theme"
            ]
        },
        "patches": {
            "drupal/commerce": {
                "Allow products to be duplicated": "https://www.drupal.org/files/issues/2019-03-26/3042258-2-duplicate-product.patch"
            },
            "drupal/group": {
                "Add a field to view and edit content's groups": "https://www.drupal.org/files/issues/2019-11-13/group-field_to_view_and_edit_content_groups-2813405-215.patch"
            },
            "drupal/commerce_stripe": {
                "Do not run cookies and script stripe on all pages (the RC3 version now tracks all users)": "https://www.drupal.org/files/issues/2020-02-03/3083393-21.patch"
            },
            "drupal/private_message": {
                "The messages are sent and remain in the form": "https://www.drupal.org/files/issues/2020-08-12/private_message-sent_messages_not_clearing-3158769-5.patch"
            }
        },
        "drupal-core-project-message": {
            "include-keys": [
                "homepage",
                "support"
            ],
            "post-create-project-cmd-message": [
                "<bg=blue;fg=white>                                                         </>",
                "<bg=blue;fg=white>  Congratulations, you’ve installed the Drupal codebase  </>",
                "<bg=blue;fg=white>  from the drupal/recommended-project template!          </>",
                "<bg=blue;fg=white>                                                         </>",
                "",
                "<bg=yellow;fg=black>Next steps</>:",
                "  * Install the site: https://www.drupal.org/docs/8/install",
                "  * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
                "  * Get support: https://www.drupal.org/support",
                "  * Get involved with the Drupal community:",
                "      https://www.drupal.org/getting-involved",
                "  * Remove the plugin that prints this message:",
                "      composer remove drupal/core-project-message"
            ]
        }
    }
}

If I update my site with this command, the patches are not applied. Same thing if I remove the module to re-download it:

ubuntu@ov-KJKJ7:~/www-drupal-com$ composer update --with-dependencies
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Generating autoload files
44 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
3
  • Are you getting any sort of message from composer? Is patching the only thing that's failing?
    – beltouche
    Sep 7, 2020 at 19:21
  • @beltouche No there is no error or warning message. Yes that's the only thing that fails.
    – sdfff
    Sep 7, 2020 at 19:22
  • @beltouche I updated my question
    – sdfff
    Sep 7, 2020 at 19:23

1 Answer 1

4

You are missing cweagans/composer-patches.

It's mentioned in the docs under Patching projects using Composer.

So simply run composer require cweagans/composer-patches once to have it added to your dependencies and then the patches will be applied.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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