Fix the "Entities exist of type x and need to be deleted before importing" drupal 8 error

Configuration management is great. But you'll encounter some difficulties at first when importing existing config to a new site. A typical error is the "Entities exist of type" error. Here's how to fix them.

The reason is that the standard installation profile installs some entities (f.e. from the shortcut module). You'll need to delete them first before the error goes away. To fix these programmatically:

drush ev '\Drupal::entityTypeManager()->getStorage("shortcut_set")->load("default")->delete();'

 

 

Saved you some valuable time?

Buy me a drink 🍺 to keep me motivated to create free content like this!