7

I have two Drupal environments with the same system.site:uuid

In the main Drupal I export the configuration with command:

drush config-export deploy -y

In the destination drupal I import the configuration with command:

drush config-import deploy -y

But I have this error

Entities exist of type Shortcut link and Default. These entities need to be deleted before importing.

And:

Unable to install the mytest theme since it does not exist.

My test was a test for create subtheme, but then I delete mytest form drupal. And I don't know what it exports now, and, placeholder I don't Know what is it

I followed this article And I have the same issue of this comment

4

Sounds like you deleted your test theme without uninstalling it. You either have to properly uninstall it, which might not be possible when it's not there or edit the core.extension.yml file in your exported config and remove it by hand.

About the other error, it looks like you are either really deleting shortcut/menu link types or, more likely, you manually "fixed" the system.site UUID. That check and UUID exists for a reason, just changing it to the same value on two different installations will do a lot of unexpected things. You would have to update lots of other UUID's too, otherwise Drupal will delete and re-create pretty much every single configuration entity in your system. Due to the changed UUID, it assumes you deleted and re-created it, so that's what it is trying to do.

And since it prevents you from deleting bundle config entity types when there is still content for that type/bundle, it gives you that error.

What is it that you are trying to do exactly? Maybe you're looking for Config Installer instead?

| improve this answer | |
  • thanks for your reply. I have SiteA with fresh installation. Export my configuration with drush config-export deploy -y get my uuid with drush cget system.site uuid. In my SiteB I have the clone of siteA Change uuid with drush cedit shortcut.set.default and set the same of siteA. When I do drush config-export deploy -y I have an errore of placeholder. I follow this tutorial (dcycleproject.org/blog/68/…) and change uuid by module, but I have the same result – monkeyUser Dec 20 '15 at 14:32
7

For:

Entities exist of type Shortcut link and Default. These entities need to be deleted before importing.

You need delete the entities of type short-cut, you can do with drush:

drush ev '\Drupal::entityManager()->getStorage("shortcut_set")->load("default")->delete();'
| improve this answer | |
  • When I try this, I get this error: bash: -c: line 0: syntax error near unexpected token ('` I'm not sure if it's because I am running drush from within ddev - my full command is: ddev drush ev '\Drupal::entityManager()->getStorage("shortcut_set")->load("default")->delete(); – therobyouknow Jan 23 at 23:24
  • The above issue can be addressed by running drush on the host, instead: github.com/drud/ddev/issues/1648#issuecomment-502757303 Because now, for a composer-based Drupal 8+ project, drush can be installed for the project using composer require drush/drush and you can create a short cut by doing this: cd web (your docroot), then ` ln -s ../vendor/drush/drush/drush .` This assumes that your source tree is 2 levels, with the site docroot in web and composer.json, .git folder etc above that by one level. – therobyouknow Jan 24 at 16:44
  • With drush setup locally as above, then the command can be issued thus: ./drush ev '\Drupal::entityManager()->getStorage("shortcut_set")->load("default")->delete();' Note the ./ preceding the command. – therobyouknow Jan 24 at 16:47
  • The above solution would not actually work for me whereby I'm running drush on the host, because the database not accessible from the host as it's associated with a docker container with ddev. So you have to actually use ddev. The way to solve the ddev issue with the bash is to escape all of the characters that could cause the issue: ddev drush ev \'\\Drupal\:\:entityManager\(\)\-\>getStorage\(\"shortcut_set\"\)\-\>load\(\"default\"\)\-\>delete\(\)\;\'- I found this actually works! I'm prefixing any special character with a backslash to "escape" it. – therobyouknow May 31 at 22:24
4

About the first error (Entities exist of type Shortcut link and Default. These entities need to be deleted before importing.):

I went to Home > Administration > Configuration > User interface > Shortcuts (admin/config/user-interface/shortcut), than in "List links" of "Default" I deleted every shortcut.

The error is gone now.

| improve this answer | |
0

Whenever you get this type of error, you need to delete the entities first.

Here's a generic Drush command that will delete any entity type, unlike another answer here. Just set the machine name in the first PHP command.

drush @site eval '$entity_type = "my_entity_type"; $storage_handler = \Drupal::entityTypeManager()->getStorage($entity_type); $storage_handler->delete($storage_handler->loadMultiple(\Drupal::entityQuery($entity_type)->execute()));'

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.