Score:0

Why is composer deleting and reinstalling core?

ae flag

I am running Drupal 9.2.4 on Lando on Mac Big Sur. When I use composer to install a module it first deletes core.

Removing package drupal/core so that it can be re-installed and re-patched.
 - Removing drupal/core (9.2.4)

Then it reinstalls it.

 - Installing drupal/core (9.2.4): Extracting archive

If the module fails to install, no core!

I think these are the relevant lines from composer.json.

"drupal/core": "^9.2.4",
"drupal/core-composer-scaffold": "@stable",
"drupal/core-project-message": "9.2.4",
"drupal/core-recommended": "@stable",

Any ideas as to why this is happening and how to prevent it from happening?

tonytheferg avatar
cn flag
Have you tried updating cweagans/composer-patches? See this issue. https://github.com/cweagans/composer-patches/issues/363
sonfd avatar
in flag
Composer tells you why it is happening: "Removing package drupal/core so that it can be **re-installed and re-patched.**"
tonytheferg avatar
cn flag
This is most likely the bug I mentioned and that is why I posted it as an answer, not a comment. I Don't appreciate that being changed.
apaderno avatar
us flag
@tonytheferg Answers are for answering the question, not asking questions to the OP or merely providing a link. Answers asking for information or merely providing a link are removed.
tonytheferg avatar
cn flag
Core being deleted and not being re installed is the bug I mentioned. It's not designed behavior for composer patches. There's not much else to say about it.
Score:3
cn flag

When there is a patch set in your composer.json file or a composer.json file in one of your packages, composer will remove the package with a patch (in this case core) and reinstall it to apply all the patches. Look for a section that looks something like:

"patches": {
            "drupal/core": {
                "3035113 - EntityAccessChecker": "https://www.drupal.org/files/issues/2019-10-21/LatestRevisionCheck-13092187-24.patch",
                "2856823 - header links": "https://www.drupal.org/files/issues/2020-11-24/2856823-48__core-9.1.x.patch",
                "2784233 - Allow multiple vocabularies in the taxonomy filter": "https://www.drupal.org/files/issues/2021-05-28/2784233-193.patch"      
            }
}

If not your composer.json file, check for a composer file of your distribution or profile. That’s the most likely place to find it.

Dorian Winterfeld avatar
ae flag
I do, in fact, have a patches section in my composer file. Thanks for pointing this out. This composer file was generated my the Acquia Migrate Accelerator module. I am wondering if I can safely remove this section?
shelane avatar
cn flag
Well, that depends. If you are still doing the migrations and need the Acquia Migrate Accelerator module, I would leave it alone. It is likely depending on those patches. Acquia does a good job of checking for updates to core and will remove patches from their module when they're not needed. So be sure to keep up-to-date. Also, be sure your `cweagans/composer-patches` is updated as mentioned by @tonytheferg
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.