3
votes

I'm new to Drupal programming but I have experienced a few problems. Every time I uninstall a module and I want to install it again.

I get this error message:

Unable to install advertisement, core.entity_form_display.node.advertisement.default, core.entity_view_display.node.advertisement.default, core.entity_view_display.node.advertisement.teaser, field.field.node.advertisement.body, node.type.advertisement already exist in active configuration.

What did I already do?

  • With drush cache-clear / cache-rebuild No result
  • In drupal self cache-clear No result
  • And even dropt the drupal database /( it works but it is kind of annoying to do it every time.) Result but a lot of work

So I think I know where the problem is (Database tables), but how do I fix it in a fast and easy way?

5
Also see this question (and its answers). - turdus-merula

5 Answers

2
votes

You can also use Drush

drush config-delete module_name.settings
1
votes

I fixed the problem with a simple Drupal command, this requires the drupal console. What you can find here!

All i had to do is to type in 2 commands

  • drupal module:uninstall advertisement
  • drupal module:install --overwrite-config advertisement
1
votes

You can use the config:delete command in the Drupal console:

drupal config:delete active CONFIG.TO.DELETE

e.g.

drupal config:delete active system.menu.devel

0
votes

This seems like a variation of the question about "How do I remove a configuration object from the active configuration?".

As per one of the answers there, I'd try to use this code in hook_uninstall to resolve the core.entity_form_display.node.advertisement.default part of your errors: Drupal::configFactory()->reset('core.entity_form_display.node.advertisement.default');

Then repeat (4 times?) for the other parts of your errors.

0
votes

Just move the config files from

config/install

to

config/optional