A Drupal 8 site started pestering me to upgrade Twig Tweak from 8.x-2.8 to 8.x-2.9. I went to the directory and ran composer require 'drupal/twig_tweak:^2.9' which seemed to work. I also did drush cr. When I go back into the Drupal web interface it still thinks I'm on the older version of Twig Tweak and wants me to upgrade. If I run the composer command again, it thinks I'm already upgraded. How do I get these two things to play nice with each other?

(You might be wondering why I didn't just use the web interface to upgrade. If I do that I have even bigger problems so I'm sticking to composer for now.)

Update: output of composer show

descrip. : A Twig extension with some useful functions and filters for Drupal development.
keywords : Drupal, Twig
versions : * 2.9.0
type     : drupal-module
license  : GNU General Public License v2.0 or later (GPL-2.0+) (OSI approved) https://spdx.org/licenses/GPL-2.0+.html#licenseText
homepage : https://www.drupal.org/project/twig_tweak
source   : [git] https://git.drupalcode.org/project/twig_tweak.git 8.x-2.9
dist     : [zip] https://ftp.drupal.org/files/projects/twig_tweak-8.x-2.9.zip 8.x-2.9
path     : /var/www/html/ycfld/modules/contrib/twig_tweak
names    : drupal/twig_tweak

source : https://git.drupalcode.org/project/twig_tweak
issues : https://www.drupal.org/project/issues/twig_tweak

drupal/core ^8.7 || ^9.0
twig/twig ^1.41 || ^2.12

symfony/var-dumper Better dump() function for debugging Twig variables```
  • 1
    "I went to the directory" - which directory? Do you have more than 1 copy of twig_tweak.info.yml located anywhere under Drupal root? Did you originally install Twig Tweak with composer?
    – anonymous
    Commented Dec 21, 2020 at 22:33
  • Are you sure it's telling you to upgrade to 2.9? twig_tweak also has a 3.0 release, which requires Drupal 9, so you may be seeing an announcement to upgrade to 3.0 even if you are on 2.9. Commented Dec 22, 2020 at 0:11
  • 1
    What about composer show drupal/twig_tweak?
    – ya.teck
    Commented Dec 22, 2020 at 14:03
  • Directory: /var/www/html/ycfld -- the root directory of this Drupal install. It's definitely telling me to upgrade to 2.9. I've updated the original post with the output of composer show.
    – Chanel
    Commented Dec 22, 2020 at 16:02
  • 1
    rm -rf web/modules/contrib && composer update drupal/twig_tweak --with-dependencies. Then in drupal you can try flushing the cache or visiting the "extend" page. Commented Dec 22, 2020 at 18:09

1 Answer 1


Do you have more than 1 copy of twig_tweak.info.yml located anywhere under Drupal root? Composer will install the module in <drupalroot>/modules/contrib. Installation through the UI will put modules in <drupalroot>/modules.

Did you originally install Twig Tweak with composer? If you originally installed the module manually/through the UI and then did a composer require, you will have two copies of the module. That won't work. You have to ensure you have one and only one copy of the module's code on your site.

The cleanest way to fix this is to uninstall the module from the UI, then remove both versions of the module code - remove both the <drupalroot>/modules/contrib version and the <drupalroot>/modules version. Then you can re-install the module using composer and re-enable it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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