Does composer remove drupal/module actually uninstall the module first, especially in multi-site environments?

On the other hand, does composer require "enable" the given module for all sites?

  • See Order of Drush commands for automated deployment, it has a paragraph about consecutive releases. This also means to run two releases if you want to remove a contrib module completely. First release to disable the module. Second release to have it removed by Composer.
    – leymannx
    Mar 12, 2019 at 20:11

2 Answers 2


No, Composer doesn’t install or uninstall modules in the site itself.

It’s a dependency manager; all it does is compute your requirements, then download them.

You might be able to add a post install/update command to automate it, but trying to make it generic would probably be a pain.

  • 3
    So it is possible to crush the site letting composer remove installed module ?
    – Paul Paku
    Mar 12, 2019 at 18:06
  • 4
    Yes, it would be like deleting a module folder without uninstalling it.
    – Kevin
    Mar 12, 2019 at 18:14
  • 1
    Is your recommendation to first uninstall the module via Drupal Admin Panel and then run composer remove drupal/module ? Is that the proper way to do this?
    – Robbiegod
    Nov 25, 2019 at 19:13
  • 1
    Yes @Robbiegod, if you remove the files before uninstalling the module there’s a good chance you’ll brick the site until you replace them. BTW is too much to hope your username is a reference to the great Robbie “God” Fowler??
    – Clive
    Nov 25, 2019 at 19:29
  • 1
    Thank you! Sorry, I am not Mr Fowler. I got the nickname awhile back when I worked at a game company (Take2) and it just kind of stuck.
    – Robbiegod
    Nov 25, 2019 at 19:44

In a Drupal site with a Composer workflow you'll need to do the following when you decide to remove a module:

  1. From your Drupal Admin, uninstall/disable the module so that Drupal doesn't expect to see it.

  2. Edit your composer.json file in the root of your Drupal installation. It should be outside the /web directory. Remove the reference to module module and save the file.

  3. run composer update

Composer will remove the module from the file system and will know that it is no longer a package in the installation.

  • 2
    1. Disable (prior to Drupal 8 you need to disable a module first) and uninstall the module. 2. Run composer remove drupal/mymodule. 3. Done
    – leymannx
    Dec 20, 2019 at 8:25
  • Do you know if remove drupal/mymodule works with Composer in Drupal 8? I have not attempted that. Dec 21, 2019 at 0:41
  • @AndrewWasson It works.
    – mbomb007
    Apr 16, 2020 at 13:57
  • Thanks @mbomb007 Apr 20, 2020 at 21:17

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.