-2

I have a project that wasn't updated since a few months and I am stuck on 9.4.3 with composer refusing to update.

Here is my composer.json

{
    "name": "drupal-composer/drupal-project",
    "description": "Project template for Drupal 9 projects with Composer",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "authors": [
        {
            "name": "",
            "role": ""
        }
    ],
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "php": ">=7.3",
        "buzzingpixel/twig-switch": "^1.0",
        "composer/installers": "^1.9",
        "cweagans/composer-patches": "^1.7",
        "drupal/admin_toolbar": "^3.0",
        "drupal/auto_entitylabel": "^3.0@beta",
        "drupal/better_exposed_filters": "^5.0@beta",
        "drupal/better_social_sharing_buttons": "^3.2",
        "drupal/ckeditor_media_embed": "^1.11",
        "drupal/ckeditor_youtube": "^1.3",
        "drupal/components": "^2.2",
        "drupal/console": "~1.0",
        "drupal/core-composer-scaffold": "^9.1",
        "drupal/core-recommended": "^9.1",
        "drupal/devel": "^4.1",
        "drupal/editor_advanced_link": "^2.0",
        "drupal/eu_cookie_compliance": "^1.19",
        "drupal/fontawesome": "^2.18",
        "drupal/gin": "^3.0@beta",
        "drupal/gin_toolbar": "^1.0@beta",
        "drupal/google_analytics": "^4.0",
        "drupal/jquery_minicolors": "^1.3",
        "drupal/mailchimp": "^2.0",
        "drupal/migrate_plus": "^6.0",
        "drupal/migrate_source_csv": "^3.5",
        "drupal/migrate_tools": "^6.0",
        "drupal/paragraphs": "^1.12",
        "drupal/pathauto": "^1.8",
        "drupal/quick_node_clone": "^1.14",
        "drupal/rabbit_hole": "^1.0@beta",
        "drupal/radix": "^4.10",
        "drupal/recaptcha": "^3.0",
        "drupal/search_api": "^1.20",
        "drupal/search_api_db": "^1.20",
        "drupal/search_api_page": "^1.0@beta",
        "drupal/signature_field": "^2.1",
        "drupal/token": "^1.9",
        "drupal/views_bootstrap": "^4.3",
        "drupal/views_bulk_edit": "^2.5",
        "drupal/views_bulk_operations": "^4.1",
        "drupal/views_simple_math_field": "^3.0",
        "drupal/webform": "^6.0",
        "drupal/weight": "^3.3",
        "drush/drush": "^10.3",
        "kint-php/kint": "^3.3",
        "twig/twig": "2.15.2",
        "vlucas/phpdotenv": "^5.1",
        "webflo/drupal-finder": "^1.2"
    },
    "require-dev": {
        "drupal/core-dev": "^9.1",
        "zaporylie/composer-drupal-optimizations": "^1.2"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "discard-changes": true,
        "sort-packages": true,
        "allow-plugins": {
            "composer/installers": true,
            "dealerdirect/phpcodesniffer-composer-installer": true,
            "drupal/console-extend-plugin": true,
            "cweagans/composer-patches": true,
            "drupal/core-composer-scaffold": true,
            "zaporylie/composer-drupal-optimizations": true
        }
    },
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ],
        "files": [
            "load.environment.php"
        ]
    },
    "scripts": {
        "pre-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "pre-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "post-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ],
        "post-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ]
    },
    "extra": {
        "drupal-scaffold": {
            "locations": {
                "web-root": "web/"
            }
        },
        "installer-paths": {
            "web/core": [
                "type:drupal-core"
            ],
            "web/libraries/{$name}": [
                "type:drupal-library"
            ],
            "web/modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "web/profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "web/themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "drush/Commands/contrib/{$name}": [
                "type:drupal-drush"
            ]
        },
        "composer-exit-on-patch-failure": true,
        "patchLevel": {
            "drupal/core": "-p2"
        },
        "patches": {
            "drupal/devel": {
                "Brings back the Available Methods & Properties tabs for Kint dumps — Issue #221": "https://raw.githubusercontent.com/politsin/snipets/master/patch/kint.patch"
            },
            "drupal/better_exposed_filters": {
                "Fix error with exposed filters arguments": "https://www.drupal.org/files/issues/2020-09-18/3159875-8.patch"
            },
            "drupal/better_social_sharing_buttons": {
                "HTMLSpecialChars error on login page": "https://www.drupal.org/files/issues/2021-06-22/3216304-4.patch"
            },
            "drupal/search_api_page":  {
                "PHP 8.1 strpos() error": "https://www.drupal.org/files/issues/2022-05-31/3274050-4-php-8-warning-pathprocessorsearchapipage.patch"
            }
        }
    }
}

If I run the following, it just doesn't update anything.

$ composer update "drupal/core-*" --with-all-dependencies

So I tried:

$ composer why-not drupal/core 9.4.12
drupal/core-recommended  9.4.3  requires  drupal/core (9.4.3) 

And also:

$ composer prohibits drupal/core-recommended 9.4.5
drupal/core-recommended         9.4.5        requires          drupal/core (9.4.5)                   
drupal-composer/drupal-project  dev-develop  does not require  drupal/core (but 9.4.3 is installed)

And also with 9.5.7 which is the recommended version I see from the admin:

$ composer prohibits drupal/core-recommended 9.5.7
drupal/core-recommended         9.5.7        requires          drupal/core (9.5.7)                                          
drupal-composer/drupal-project  dev-develop  does not require  drupal/core (but 9.4.3 is installed)                         
drupal/core-recommended         9.5.7        requires          laminas/laminas-diactoros (~2.14.0)                          
drupal-composer/drupal-project  dev-develop  does not require  laminas/laminas-diactoros (but 2.11.3 is installed)          
drupal/core-recommended         9.5.7        requires          laminas/laminas-stdlib (~3.11.0)                             
drupal-composer/drupal-project  dev-develop  does not require  laminas/laminas-stdlib (but 3.7.1 is installed)              
drupal/core-recommended         9.5.7        requires          symfony/polyfill-ctype (~v1.27.0)                            
drupal-composer/drupal-project  dev-develop  does not require  symfony/polyfill-ctype (but v1.25.0 is installed)            
drupal/core-recommended         9.5.7        requires          symfony/polyfill-iconv (~v1.27.0)                            
drupal-composer/drupal-project  dev-develop  does not require  symfony/polyfill-iconv (but v1.25.0 is installed)            
drupal/core-recommended         9.5.7        requires          symfony/polyfill-intl-idn (~v1.27.0)                         
drupal-composer/drupal-project  dev-develop  does not require  symfony/polyfill-intl-idn (but v1.25.0 is installed)         
drupal/core-recommended         9.5.7        requires          symfony/polyfill-intl-normalizer (~v1.27.0)                  
drupal-composer/drupal-project  dev-develop  does not require  symfony/polyfill-intl-normalizer (but v1.25.0 is installed)  
drupal/core-recommended         9.5.7        requires          symfony/polyfill-mbstring (~v1.27.0)                         
drupal-composer/drupal-project  dev-develop  does not require  symfony/polyfill-mbstring (but v1.25.0 is installed)         
drupal/core-recommended         9.5.7        requires          symfony/polyfill-php80 (~v1.27.0)                            
drupal-composer/drupal-project  dev-develop  does not require  symfony/polyfill-php80 (but v1.25.0 is installed)            
drupal/core-recommended         9.5.7        requires          twig/twig (~v2.15.4)                                         
drupal-composer/drupal-project  dev-develop  requires          twig/twig (2.15.2) 

Any idea what is going on? I am having a hard time figuring out what prevents the update.

2
  • 2
    I think it's not a good idea to post an entire composer.json before it was cleaned up. For example, why did you pin twig/twig to a specific version, why you still need aporylie/composer-drupal-optimizations, are all beta versions still maintained?
    – 4uk4
    Apr 11 at 9:21
  • @4uk4 Thanks for the feedback. I had to require that specific Twig version because of an issue with one of the themes (Claro). I have disabled the theme now and removed Twig but still no luck.
    – MrUpsidown
    Apr 11 at 11:52

1 Answer 1

2

As soon as you remove twig/twig from your composer.json it will work.

$ composer remove twig/twig --no-update
$ composer update "drupal/core-*" --with-all-dependencies

(You then need to update the patches, but that's a different issue. Also move drupal/devel and kint-php/kint to require-dev, this should never land on prod. Aaand you should also update your PHP and update the PHP requirement in the composer.json then.)

8
  • Thanks but still no luck. I am on PHP 8.1.9 now, and updated the PHP requirement to "php": "^7.3||^8.0" but running the composer update leads to Nothing to install, update or remove.
    – MrUpsidown
    Apr 11 at 13:07
  • @MrUpsidown – I used your composer.json when trying. There must be errors that are different than no luck 😉. Please update your question with the progress.
    – leymannx
    Apr 11 at 13:21
  • 2
    Unless you're comfortable working through this stuff yourself, it's probably best to bite the bullet, delete composer.lock, run composer install, and deal with testing the changes to any contrib module updates that result. Trying to debug and work through this in a back-and-forth in the comments here isn't likely to get anyone a useful a result
    – Clive
    Apr 12 at 11:23
  • 1
    Oh boy! Thanks @Clive, that actually did the trick. I deleted the lock file, ran composer install and it locked all modules, upgraded what needed to be upgraded, including Upgrading drupal/core-recommended (9.4.3 => 9.5.7) and all seems fine! If you wish to provide this as an answer, feel free! Thanks
    – MrUpsidown
    Apr 13 at 9:42
  • 1
    Most times a simple composer update will do the trick, too. After of course, you've resolved the main problem, the twig/twig version @leymannx successfully reproduced, and after removing all outdated packages.
    – 4uk4
    Apr 13 at 9:57

Your Answer

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

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