Advertising sustains the DA

Body

This documentation needs work. See "Help improve this page" in the sidebar.

 

In order to uninstall the module, be sure that the module is not being used on your site so that it does not impact any functionality.
You can use either the Drush or the Administrative Interface to uninstall modules.

Using Drush

Pre-requisite: Drush should be installed on your machine.
To install Drush check How to install Drush.

Run the following Drush command to uninstall the module:
drush pm-uninstall module_name

Or use the Drush alias:
drush pmu module_name

Next, clear cache using the Drush command:
drush cr

That's it. The uninstalled module will no longer show as checked in the module list and the functionality of the module will have been removed from the site.

Using the Administrative Interface

  1. In the Manage administrative menu, navigate to Extend > Uninstall tab (admin/modules/uninstall) where you will find the list of enabled modules that are ready to be uninstalled.
  2. You can search or filter for the module to be uninstalled by typing the module name in the search field.
  3. Check the box/boxes of modules that you want to uninstall.
  4. Click the Uninstall button at the bottom of the page.
  5. Step 4 will prompt you to confirm the module uninstall request.
  6. Click Uninstall.
  7. Go to the link manage>configuration>development>performance click on clear all cache.

The functionality of the uninstalled module will now have been removed from the site.

Using composer

Having uninstalled the module, you can then remove the module code from your server using composer. Be sure to uninstall via the admin interface or by using Drush before removing the codebase.

Run composer remove drupal/module

References to this module in composer.json and composer.lock should be removed, as well as the folder in the directory path (e.g. in /modules/contrib/)

Verify in /admin/modules/ module had been removed

If for some reason, module folder gets retained in the /modules/contrib directory, you may now safely delete it now, e.g. running rm -rf module_name from that directory

Run the usual update.php, drush updb, drush cache:rebuild, etc. to clean-up and flush system

Refer also to https://www.drupal.org/forum/support/post-installation/2022-03-04/uninstall-modules-that-were-installed-with-composer

Knowledge Category