7

When running (right after site install) the drush cim -y command, the following error appears:

Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization. in Drupal\Core\Config\ConfigImporter->validate() (line 728 of /var/www/ifc_test/web/core/lib/Drupal/Core/Config/ConfigImporter.php).
The import failed due for the following reasons:                                                                           
Unable to install the <em class="placeholder">XYZ</em> module since it requires the <em class="placeholder">YAML
Editor</em> module.
Configuration <em class="placeholder">XYZ.conf</em> depends on the <em
class="placeholder">YAML Editor</em> module that will not be installed after import.
Configuration <em class="placeholder">yaml_editor.config</em> depends on the <em class="placeholder">YAML Editor</em> module that will
not be installed after import.

(the XYZ is the name of the custom module)

  1. I have the yaml_editor contrib module physically under modules.
  2. There is dependency declared in the config files above.
  3. I also added "yaml_editor" to core.extension.yml" to make sure, it should be installed.

Why config importer not enabling the "yaml_editor"? I mean, that's what dependency declaration is for. Also, I've got a couple of other modules which are not enabled after site-install, they will be enabled tho during the drush cim process.

Of course drush en yaml_editor -y solves the problem, however, it's part of a building process, and I don't want to just insert an extra line into deployment script, just because this strange thing is happening.

Any ideas why config management doesn't enable (installs) this dependency, and why it says: "that will not be installed after import"?

9

Adding the yaml_editor to core.extension.yml solved the issue. It perhaps were removed due to a complex git merge, and that's why my install process started to fail all that sudden.

  • This happened with me also. Thank you for your advice. It helped a lot. – Eugene Sep 18 '17 at 9:49
2

I had the same issue. My situation as follow

Custom module with configuration. On export, the module's configuration data exported with name match the the code(php) configuration name as (xxx.settings.yml). If the "xxx" doesn't match the module name, the error occurs.

I changed the configuration name in the source code and it's working fine.

1

Suggestions:

  • Try partial import by: drush config-import --partial.
  • Make sure the required/missing module is present in core.extension.yml, e.g.

    module:
      missing_module: 0
    

    Note: If you're using Configuration Split module, make sure to populate the module to all files.

  • Make sure you've run drush updb and cleared cache (drush cr).

  • Try exporting first (especially core.extension.yml), then import again.
  • Try to Synchronize from the UI (at /admin/config/development/configuration).

Drupal Console

As for the alternative approach, try to do config import using Drupal Console, sometimes it can give you more clues about what's wrong. E.g.

drupal config:import

Or for a single item or a file (--file), try:

drupal config:import:single
  • Have you read the accepted answer? – ssibal Jul 18 '18 at 15:13
  • 1
    Yes, but there could be the multiple causes of the same error. Your answer is the very edge case. I had similar errors, but the solution was different. Therefore I'm providing more tips and debugging guidance for future users who are experiencing a similar error and finding this thread, as they could lead them to the solution. – kenorb Jul 18 '18 at 15:18
0

The real cause:

Yaml Editor module was added to drushcr.php under web/sites/default the following way:

$command_specific['config-export']['skip-modules'] = ['yaml_editor'];
$command_specific['config-import']['skip-modules'] = ['yaml_editor'];

This way you can ignore modules from drush cim and/or cex to enable/disable modules. This is very useful when developing, since module likes devel, kint etc. will be enabled on your localhost, but when you make changes in the config, and you make a cex, these development modules won't be enabled on the production site.

0

Checkout your config with the latest code, run drush cr.

After that import your configuration to local.

drush cim -y

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.