Drupal 8 error: “The following reasons prevent the modules from being uninstalled: Fields pending deletion”

When you try and uninstall a module which 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 in both Drupal 7 and Drupal 8. 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(500);'

Increase 500 to a high enough number to wipe out the data. Afte this has completed, you should be able to uninstall the module

References:
Module uninstall dependencies (drupal stackexchange)
Message “Required by Drupal (Fields Pending Deletion)” baffles users
Can’t uninstall YAML because of following reason: Fields pending deletion

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s