Drupal 8 & 9: Resolved: The following reasons prevent the modules from being uninstalled: Fields pending deletion
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
In my case, it was when I tried to disable the "Comment" module. 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 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);'
You can also use an user interface provided by
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.