Drupal 10 composer install with core-recommended crash with drupal/twig_tweak

Created on 20 September 2023, 9 months ago
Updated 28 January 2024, 5 months ago

I'm installing drupal/twig_tweak via composer

composer require drupal/twig_tweak:^3.2

and i get these errors:

    - drupal/twig_tweak dev-3.x requires twig/twig ^2.15.3 || ^3.4.3 -> found twig/twig[v2.15.3, v2.15.4, v2.15.5, 2.x-dev, v3.4.3, ..., 3.x-dev] but the package is fixed to v3.3.7 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - drupal/twig_tweak[3.2.0, ..., 3.2.1] require twig/twig ^2.12 || ^3.3.8 -> found twig/twig[v2.12.0, ..., 2.x-dev, v3.3.8, ..., 3.x-dev] but the package is fixed to v3.3.7 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - drupal/twig_tweak 3.x-dev is an alias of drupal/twig_tweak dev-3.x and thus requires it to be installed too.
    - Root composer.json requires drupal/twig_tweak ^3.2 -> satisfiable by drupal/twig_tweak[3.2.0, 3.2.1, 3.x-dev (alias of dev-3.x)].

I checked composer.lock file and i found that drupal/core-recommended fix twig/twig version to v3.3.7

       {
            "name": "drupal/core-recommended",
            "version": "10.0.0-alpha1",
            ......
            "require": {
                "asm89/stack-cors": "v2.0.5",
                "composer/semver": "3.2.7",
                "doctrine/annotations": "1.13.2",
                "doctrine/lexer": "1.2.2",
                "drupal/core": "10.0.0-alpha1",
                .......
                "symfony/yaml": "v5.4.2",
                "twig/twig": "v3.3.7"
            },
            ......
        },

And if i try to install twig/twig separetly via composer require twig/twig:^3.4.3 or directly from composer.json, in order to fix the version, then i get error:

    - drupal/core-recommended is locked to version 10.0.0-alpha1 and an update of this package was not requested.
    - drupal/core-recommended 10.0.0-alpha1 requires twig/twig v3.3.7 -> found twig/twig[v3.3.7] but it conflicts with your root composer.json require (^3.4.3).

any ideas how to fix these errors?
or rather how to install twe on drupal 10 based on drupal/core via composer?

💬 Support request
Status

Closed: cannot reproduce

Version

3.2

Component

Code

Created by

🇫🇷France HasinaNjaratin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @HasinaNjaratin
  • Status changed to Closed: cannot reproduce 9 months ago
  • 🇫🇷France HasinaNjaratin

    This is cause of wrong version of drupal core. to fix it, make sure getting a right drupal core version.

  • 🇺🇸United States codechefmarc

    Hi HasinaNjaratin, I'm running into this as well. You mentioned that the fix is to get the right Drupal core version. I've got the following in my root composer.json file:

    "drupal/core-composer-scaffold": "^10",
    "drupal/core-project-message": "^10",
    "drupal/core-recommended": "^10",

    Which should get us 10.1, but I'm still getting errors like you were. What did you eventually put as your Drupal version to make this work? Thanks!

  • 🇮🇳India ankithashetty Karnataka, India

    +1 to this!

  • 🇮🇸Iceland drupalviking

    +2 on this, I had a problem updating to 10. The best I can go now is 10.0.0 :-(

    I get similar errors:

    Problem 1
        - Root composer.json requires drupal/core-recommended ^10.1, found drupal/core-recommended[10.1.0-alpha1, ..., 10.2.x-dev] but the package is fixed to 10.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
      Problem 2
        - drupal/twig_tweak is locked to version 3.2.1 and an update of this package was not requested.
        - drupal/twig_tweak 3.2.1 requires twig/twig ^2.12 || ^3.3.8 -> found twig/twig[v2.12.0, ..., 2.x-dev, v3.3.8, ..., 3.x-dev] but these were not loaded, likely because it conflicts with another require.
      Problem 3
        - drupal/core 10.0.0 requires twig/twig ^3.4.3 -> found twig/twig[v3.4.3, ..., 3.x-dev] but these were not loaded, likely because it conflicts with another require.
        - drupal/stage_file_proxy 2.1.3 requires drupal/core ^9 || ^10 -> satisfiable by drupal/core[10.0.0].
        - drupal/stage_file_proxy is locked to version 2.1.3 and an update of this package was not requested.
    
    Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
    Composer [update twig/twig:3.6 --dry-run] failed, composer command failed: exit status 2. stderr=
  • Status changed to Active 5 months ago
  • 🇮🇸Iceland drupalviking

    I opened this issue again since I just encountered this problem today, so clairly I was able to reproduce.

  • 🇷🇺Russia Chi

    Use the option --with-all-dependencies (-W) to allow upgrades,

    Have you tried this?

    Composer is known for its pure description of dependency conflicts. Sometimes it's easier to just remove the package that you think is blocking update, then update what you need and install the package again.

  • Status changed to Closed: cannot reproduce 5 months ago
  • 🇷🇺Russia Chi
Production build 0.69.0 2024