0

I have a Drupal 8.9.13. I wanted to install a new module, for example the google_tag. But in my case I do that in my CI/CD process. So to do that I did the following actions:

  1. edit the composer.json in a way to contain the new module
  2. the composer.lock is updated for the same reason (by enabling the module using drush)
  3. updated the core.extension.yml in a way to contain a line
  4. generated the *.settings.yml by exporting the configuration.

During the deployment, first of all the code source is get from the git repo and then a 'composer install' is called. After that a "./vendor/bin/drush config-import -y" is called to import the configuration of the new module (event the module wasn't configured, there is a default config). And here I have the following error:

Unable to install the google_tag module since it does not exist.

Does someone have any idea what might be the problem?

I saw also that in Drupal's database in the table config for the value of core.extension I have a value which usually describes the activated modules and the one I am trying to activate is not there.

7
  • Does this answer your question? Order of drush commands for automated deployment? – leymannx Apr 28 at 16:23
  • 1
    @leymannx Wow great find! I'm switching to this command in our own scripts now! – Ryan Hartman Apr 28 at 18:51
  • @leymannx thank's for the link. Yes, it gives some insights to the process of deployment and how the thing should be organised. I am not an expert in Drupal and I can't say how much the problem discussed in the link you gave is close to my case. But it was interesting to read it :) – Anton Apr 29 at 12:17
  • Does the problem persist when you use drush -y deploy or drush cr && drush -y cim instead? That's why I linked this question. – leymannx Apr 29 at 12:27
  • Doing the drush commands in the order you said, solves the issue :) – Anton Apr 29 at 12:32
0

After running composer install, you need to add a drush cr before you run drush cim. All together:

composer install
./vendor/bin/drush cr
./vendor/bin/drush config-import -y
2
  • Thanks for the reply! I tested it and it worked. However it remains to me to understand what exactly is the purpose of "drush cr" and how it reflects to the following "drush config-import -y". I am still a newbie with Drupal and the concept of "cache rebuild" command is not very clear not me. I'm asking myself how the cache is related to the configuration ..? – Anton Apr 29 at 12:21
  • Composer adds the requirements into vendor. modules and theme folders for drupal. Drush cr is shorthand for cache-rebuild, there are a few different types of caches, and one of them relates to what modules and themes exist. Config import often times will enable or uninstall a module/theme, so it needs a fresh cache to know what is there and what is not. – Ryan Hartman Apr 30 at 17:21

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.