Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Drupal 8 & 9: Resolved: The following reasons prevent the modules from being uninstalled: Fields pending deletion

Parent Feed: 

When you try to uninstall a module that has a field that you have used, it can throw the following error:

The following reasons prevent the modules from being uninstalled: Fields pending deletion

This is an issue that can happen in both Drupal 8 and Drupal 9. This is due to the fact that Drupal doesn’t actually delete the data for the field when you delete the field. It deletes the data during cron runs. If cron hasn’t been run enough times since you deleted the field, drupal won’t let you uninstall the module.

To force drupal to purge the data, you can run the following command

drush php-eval  'field_purge_batch(1000);'

Increase 1000 to a high enough number to wipe out the data, or run a few times. After this has completed, you should be able to uninstall the module.

References:
Module uninstall dependencies (drupal stackexchange)
The message "Required by Drupal (Fields Pending Deletion)" baffles users
Can’t uninstall YAML because of the following reason: Fields pending deletion

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web