Skip to main content

Drupal 8: Cannot uninstall comment module - Fields pending deletion

How to uninstall the comments module in drupal 8 and get rid off the "fields pending deletion" message when you run drush pm:uninstall comment ?

If you run

drush pm:uninstall comment

you will get an error message like this 

comment: The <em class="placeholder">Comments</em> field type is used in the following fields: node.comment, node.comment_node_article, node.comment_node_page    

First you have to delete all the comment reference fields from all the entities that are using the comment entity as a reference field.

drush php-eval 'field_purge_batch(500);'

and finally

drush pm:uninstall comment

You are done :)