Drush Force Remove Module

By sysop, 26 October, 2023

Drush Force Remove Module

Drush Force Remove Module

Drush Force Remove Module - This can be done with the below command:

drush cdel core.extension module.your_module_name

While working on a Drupal site, we sometimes face an issue with the module uninstall. We can neither uninstall a module using "drush" command line interface or either from the Drupal module extend's page.

This could happen due to different reasons:

  • Like module upgrade failure. Data loss caused by some of the module upgrade due to unexpected dependencies.
  • Residues like configurations which were left from uninstalled module causing issues when re-enabled.
  • Due to some misconfiguration in the settings.php file.
  • Module enabled but is not configured in settings.php file.
  • Some modules, for example civicrm is enabled but no civicrm.settings.php file present.

Above reasons could take the entire site down. If we try to uninstall an affected module, drush throws an error. We get "module cannot be uninstalled due to so and so reason". If we navigate to browser, site throws an unexpected error. We can use above drush command to uninstall the module to bring back the site. Also, to get a breather to fix the issues that we are encountering. We can check the Drupal dblogs, php error logs and your configuration settings to fix the issues according to errors that we encounter.

Hope this Drush Force Remove Module documentation helps!!!