How do I forcefully uninstall any module having content? I want to uninstall the Field module, but this module can not be uninstalled; when I try, I get the following message.


  Field API to add fields to entities like nodes and users. Machine
  name: field Version: 8.0.6 Required by: TextNodeAdmin ToolbarAdmin
  Toolbar Extra ToolsFileOptionsAggregator (disabled) ImageAccelerated
  Mobile Pages (AMP) (disabled)Custom BlockBook (disabled)Text
  EditorCKEditorCommentInterface TranslationConfiguration Translation
  (disabled)


How do I forcefully uninstall any module that is having dependency or content inside, for example the Node module, the Views module, or any entity having content in it?

I tried using \Drupal::service('module_installer')-&gt;uninstall(['admin_toolbar']); but then my site breaks.
For example, I made any custom content entity type and add content
  into it. Now I can not uninstall my custom module until and unless I
  delete all content or truncate module specific db table – Sugandh Khanna.


Unfortunately, in Drupal 8 you can't disable a module, like you can in Drupal 7.

In Drupal 7 you need to disable the module first, which means all module related code stays in DB. Then, if you wanted, you Uninstall to remove everything from DB. 

In Drupal 8 the only option is to uninstall the module, which means you have to destroy all traces of your module from the Database. You cannot just disable the module anymore.

Also, to uninstall Flag (as in your comment here), you have to uninstall dependencies first, then and only then, it will allow you to uninstall Flag. Because if module X depends on Flag and somehow you removed flag, it will totally screw up module X, X becomes useless, module X is nothing without Flag. Therefore you need to remove module X first, then and only then it will allow you to remove Flag.

For more info: Why can't I uninstall modules in Drupal 8? (Explained)

Issue: Disabled modules are broken beyond repair so the "disable" functionality needs to be removed