I'm building a Lightning BLT project and recently the deploy:build failed because the features module merged a patch composer.json was set to apply.

Is there a way to indicate to composer that the patch is already applied and to skip it?


Is there a way for composer to know programmatically, perhaps from the module code itself, that the patch has been applied?


Run your deploy build locally and if a patch fails during composer up and you see that it has already been integrated into the module, then delete the patch from composer.json.

  • This my current process. It's kind of a bummer because I have to wait for a build to fail then manually investigate the module. Also, in my composer.json the patch url is included, but not the issue thread, so a little bit of digging is required to find the right issue. I updated the question to indicate just how lazy I want to be. :-p – ponies Nov 4 '16 at 17:40
  • That "digging" is why it is recommended (including a button to create a good filename) to include the issue ID and comment in every patch file. There is no way around doing this yourself. Note that composer install will always download the same versions as before, even with a dev version. That means composer install should never suddenly start to fail, only when you run composer update, wich you need to do manually anyway. – Berdir Nov 5 '16 at 13:46

Composer-Patches: https://github.com/cweagans/composer-patches

Simple patches plugin for Composer. Applies a patch from a local or remote file to any package required with composer.

Example composer.json:

  "require": {
    "cweagans/composer-patches": "~1.0",
    "drupal/drupal": "~8.2"
  "config": {
    "preferred-install": "source"
  "extra": {
    "patches": {
      "drupal/drupal": {
        "Add startup configuration for PHP server": "https://www.drupal.org/files/issues/add_a_startup-1543858-30.patch"

Error handling:

If a patch cannot be applied (hunk failed, different line endings, etc.) a message will be shown and the patch will be skipped.

To enforce throwing an error and stopping package installation/update immediately, you have two available options:

1) Add "composer-exit-on-patch-failure": true option to the extra section of your composer.json file.

2) Export COMPOSER_EXIT_ON_PATCH_FAILURE=1 By default, failed patches are skipped.

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.