1

I'm trying update Drupal 9, but composer is failing on symfony/var-dumper or symfony/cache versions.

$ composer update
For additional security you should declare the allow-plugins config with a list of packages names that are allowed to run code. See https://getcomposer.org/allow-plugins
This warning will become an exception once you run composer update!
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires drupal/core-dev 9.3.0 -> satisfiable by drupal/core-dev[9.3.0].
    - You can only install one version of a package, so only one of these can be installed: symfony/var-dumper[v3.4.0, ..., v3.4.47, v4.0.0, ..., v4.4.42, v5.0.0, ..., v5.4.9, v6.0.0, ..., v6.1.0].
    - drupal/core-recommended 9.0.0 requires symfony/var-dumper v5.1.0 -> satisfiable by symfony/var-dumper[v5.1.0].
    - drupal/core-dev 9.3.0 requires symfony/var-dumper ^5.4 -> satisfiable by symfony/var-dumper[v5.4.0, ..., v5.4.9].
    - Root composer.json requires drupal/core-recommended 9 -> satisfiable by drupal/core-recommended[9.0.0].

I had been trying to update OwlCarousel, which won't work. I noticed I had the 1.x version installed, so I removed it and then tried to add owlcarousel2. But with no luck. I tried with setting minimum-stability to both dev and stable, specifying just drupal/owlcarousel2 and 'drupal/owlcarousel:^2.0@RC'

Composer gives me:

$ composer require drupal/owlcarousel2
Using version ^1.0@RC for drupal/owlcarousel2
./composer.json has been updated
Running composer update drupal/owlcarousel2
Loading composer repositories with package information
Updating dependencies
Info from https://repo.packagist.org: #StandWithUkraine
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires drupal/owlcarousel2 ^1.0@RC -> satisfiable by drupal/owlcarousel2[1.0.0-rc1].
    - drupal/owlcarousel2 1.0.0-rc1 requires drupal/core ~8.0 -> found drupal/core[8.0.0-beta6, ..., 8.9.x-dev] but the package is fixed to 9.3.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.

What happens when I just try composer update ...


  Problem 1
    - drupal/core 8.0.0-beta6 requires doctrine/common dev-master#a45d110f71c323e29f41eb0696fa230e3fa1b1b5 -> found doctrine/common[2.1.3, ..., 2.13.x-dev, 3.0.0, ..., 3.3.x-dev] but it does not match the constraint.
    - Root composer.json requires drupal/core-recommended 9.3.0 -> satisfiable by drupal/core-recommended[9.3.0].
    - drupal/owlcarousel2 1.0.0-rc1 requires drupal/core ~8.0 -> satisfiable by drupal/core[8.0.0-beta6, ..., 8.9.x-dev].
    ...

I have no idea why drupal 8.* is being mention here. "drupal/core 8.0.0-beta6..." -- I painstakingly rebiult from scratch on 9.x (I used to love working with drupal but now it's the bane of my existence.)

I troll the web looking for similar problems to mine, and run randomly found commands like this one:

composer require 'drupal/core-recommended:9' 'drupal/core-composer-scaffold:9' 'drupal/core-project-message:9' --update-with-dependencies --no-update
  533  composer update --with-all-dependencies

Now there's no mention of drupal 8.* in the output, but I still can't install Owlcarousel2 or run composer update.

Honestly, I feel composer and drupal together is a failure. I've been using composer for ~3+ years on this codebase, but to get it from 8.9 to 9.x I had to completely toss it and restart from the ground up on drupal/core-recommened 9.x. And even then, after installing ~10-12 modules I find myself here again--with composer just about never running successfully, and I spend a WEEK mucking with it to no avail.

Where was I...

$ composer why symfony/var-dumper
For additional security you should declare the allow-plugins config with a list of packages names that are allowed to run code. See https://getcomposer.org/allow-plugins
This warning will become an exception once you run composer update!
drupal/core-dev         9.3.0   requires  symfony/var-dumper (^5.4)
drupal/core-recommended 9.3.0   requires  symfony/var-dumper (v5.4.0)
drush/drush             11.0.9  requires  symfony/var-dumper (^4.0 || ^5.0 || ^6.0)
psy/psysh               v0.11.4 requires  symfony/var-dumper (^6.0 || ^5.0 || ^4.0 || ^3.4)
symfony/cache           v5.4.8  conflicts symfony/var-dumper (<4.4)
symfony/error-handler   v4.4.34 requires  symfony/var-dumper (^4.4|^5.0)

So is symfony/cache the problem?

In composer.lock I find the symfony framework-bundle section:

        {
            "name": "symfony/framework-bundle",
            "version": "v4.4.37",
            "source": {
                "type": "git",
                "url": "https://github.com/symfony/framework-bundle.git",
                "reference": "5ae3655a69ac8b6a7bf46ce2b1e04b7be2ec05c7"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/5ae3655a69ac8b6a7bf46ce2b1e04b7be2ec05c7",
                "reference": "5ae3655a69ac8b6a7bf46ce2b1e04b7be2ec05c7",
                "shasum": ""
            },
            "require": {
                "ext-xml": "*",
                "php": ">=7.1.3",
                "symfony/cache": "^4.4|^5.0",
                "symfony/config": "^4.4.11|~5.0.11|^5.1.3",
                "symfony/dependency-injection": "^4.4.1|^5.0.1",
                "symfony/error-handler": "^4.4.1|^5.0.1",
                "symfony/filesystem": "^3.4|^4.0|^5.0",
                "symfony/finder": "^3.4|^4.0|^5.0",
                "symfony/http-foundation": "^4.4|^5.0",
                "symfony/http-kernel": "^4.4",
                "symfony/polyfill-mbstring": "~1.0",
                "symfony/polyfill-php80": "^1.16",
                "symfony/routing": "^4.4.12|^5.1.4"
            },
            "conflict": {
                "doctrine/persistence": "<1.3",
                "phpdocumentor/reflection-docblock": "<3.0|>=3.2.0,<3.2.2",
                "phpdocumentor/type-resolver": "<0.3.0|1.3.*",
                "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0",
                "symfony/asset": "<3.4",
                "symfony/browser-kit": "<4.3",
                "symfony/console": "<4.4.21",
                "symfony/dom-crawler": "<4.3",
                "symfony/dotenv": "<4.3.6",
                "symfony/form": "<4.3.5",
                "symfony/http-client": "<4.4",
                "symfony/lock": "<4.4",
                "symfony/mailer": "<4.4",
                "symfony/messenger": "<4.4",
                "symfony/mime": "<4.4",
                "symfony/property-info": "<3.4",
                "symfony/security-bundle": "<4.4",
                "symfony/serializer": "<4.4",
                "symfony/stopwatch": "<3.4",
                "symfony/translation": "<4.4",
                "symfony/twig-bridge": "<4.1.1",
                "symfony/twig-bundle": "<4.4",
                "symfony/validator": "<4.4",
                "symfony/web-profiler-bundle": "<4.4",
                "symfony/workflow": "<4.3.6"
            },

I've been trying to build in the most mainstream way, so as to avoid these dependency issues.

In some threads I see people ask "Why do you have drupal/core-dev ? Other threads respond that it's a requirement for drupal/core-recommended. Some say "delete your composer.json, composer.lock, symfomny.lock, and/or vendor folder." Huh?! I have stuff in vendor that I'd have to copy out and save, then replace, etc. Is this really a solution? Doesn't composer.json store what's installed?

I'd appreciate any advice on fixing this install.

Also, how can I use drupal and composer and not have to cross my fingers and hold my EVERY TIME I run updates or have to add a module?

composer.json:

{
    "name": "drupal/recommended-project",
    "description": "Project template for Drupal 9 projects with a relocated document root",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "homepage": "https://www.drupal.org/project/drupal",
    "support": {
        "docs": "https://www.drupal.org/docs/user_guide/en/index.html",
        "chat": "https://www.drupal.org/node/314178"
    },
    "repositories": {
        "0": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        "owlcarousel2": {
            "type": "package",
            "package": {
                "name": "owlcarousel2/owlcarousel2",
                "version": "2.3.4",
                "type": "drupal-library",
                "dist": {
                    "type": "zip",
                    "url": "https://github.com/OwlCarousel2/OwlCarousel2/archive/2.3.4.zip"
                }
            }
        },
        "tiny_slider": {
            "type": "package",
            "package": {
                "name": "ganlanyuan/tiny-slider",
                "version": "2.9.3",
                "type": "drupal-library",
                "dist": {
                    "type": "zip",
                    "url": "https://github.com/ganlanyuan/tiny-slider/archive/refs/tags/v2.9.3.zip"
                }
            }
        }
    },
    "require": {
        "composer/installers": "^1.9",
        "drupal/admin_theme": "^1.0@beta",
        "drupal/aegan": "1.1",
        "drupal/at_tools": "^3.3",
        "drupal/backup_migrate": "^5.0",
        "drupal/better_search": "^1.6",
        "drupal/blazy": "^2.11",
        "drupal/blazy_ui": "^2.11",
        "drupal/ckeditor_config": "^3.1",
        "drupal/ckeditor_div_manager": "^2.0",
        "drupal/ckeditor_video": "1.x-dev",
        "drupal/core-composer-scaffold": "9",
        "drupal/core-dev": "9.3.0",
        "drupal/core-project-message": "9",
        "drupal/core-recommended": "9",
        "drupal/ctools": "^3.7",
        "drupal/editor_advanced_link": "1.9",
        "drupal/entity": "^1.3",
        "drupal/entity_clone": "^1.0@beta",
        "drupal/exclude_node_title": "^1.3",
        "drupal/externalauth": "1.4",
        "drupal/fakeobjects": "^1.1",
        "drupal/imce": "^2.4",
        "drupal/jira_issue_collector": "^1.2",
        "drupal/juicebox": "3.0.0-alpha2",
        "drupal/libraries": "^3.0@beta",
        "drupal/menu_item_role_access": "^2.0",
        "drupal/node_class": "^2.0",
        "drupal/nodeaccess": "^1.1",
        "drupal/owlcarousel2": "^1.0@RC",
        "drupal/pathauto": "^1.10",
        "drupal/profile": "^1.4",
        "drupal/simplesamlphp_auth": "^3.2",
        "drupal/slick": "2.6",
        "drupal/slick_extras": "1.0-rc7",
        "drupal/slick_views": "^2.6",
        "drupal/svg_image": "1.16",
        "drupal/tiny_slider": "^1.0@beta",
        "drupal/token": "^1.10",
        "drupal/vapn": "^1.5",
        "drupal/views_accordion": "^2.0",
        "drupal/views_slideshow": "4.8",
        "drush/drush": "^11.0"
    },
    "require-dev": {},
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "sort-packages": true
    },
    "extra": {
        "drupal-scaffold": {
            "locations": {
                "web-root": "./"
            }
        },
        "installer-paths": {
            "core": [
                "type:drupal-core"
            ],
            "libraries/{$name}": [
                "type:drupal-library"
            ],
            "modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "drush/Commands/contrib/{$name}": [
                "type:drupal-drush"
            ],
            "modules/custom/{$name}": [
                "type:drupal-custom-module"
            ],
            "profiles/custom/{$name}": [
                "type:drupal-custom-profile"
            ],
            "themes/custom/{$name}": [
                "type:drupal-custom-theme"
            ]
        },
        "drupal-core-project-message": {
            "include-keys": [
                "homepage",
                "support"
            ],
            "post-create-project-cmd-message": [
                "<bg=blue;fg=white>                                                         </>",
                "<bg=blue;fg=white>  Congratulations, you’ve installed the Drupal codebase  </>",
                "<bg=blue;fg=white>  from the drupal/recommended-project template!          </>",
                "<bg=blue;fg=white>                                                         </>",
                "",
                "<bg=yellow;fg=black>Next steps</>:",
                "  * Install the site: https://www.drupal.org/docs/8/install",
                "  * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
                "  * Get support: https://www.drupal.org/support",
                "  * Get involved with the Drupal community:",
                "      https://www.drupal.org/getting-involved",
                "  * Remove the plugin that prints this message:",
                "      composer remove drupal/core-project-message"
            ]
        }
    }
}
4jag
  • 11
  • 2
  • 1
    Show how your composer.json file looks. – Cyclonecode Jul 22 '22 at 23:34
  • On your commentary perhaps using symfony is a failure with drupal but that is on a different ground. I'd say this must not be the obvious problem, but that dependency management is hard and you normally don't want to deal with the details. As composer only install dependencies, what prevents you to fork your project out in a different worktree for testing and then require only what you actually want? It is not much isolation needed and it could be straight forward with git or any other VCS. All it needs is to remove the lock file and clean-up the require(s) in composer.json. Just an idea. – hakre Jul 23 '22 at 07:42
  • 1
    Upgrading major versions with composer can be tough. In your case it sort of looks like you have Symfony 4 installed which for Drupal 9 seems problematical. I personally have gotten used to starting from scratch (with respect to composer) when upgrading. I think you have tried the same? If so then add the actual commands you used to your post. Start with `composer create-project drupal/recommended-project my_site_name_dir` and go from there until you hit an error. Also include your PHP and Composer versions. – Cerad Jul 23 '22 at 13:21
  • Please share more details. Which package dependencies are listed in your composer.json? – Nico Haase Jul 24 '22 at 12:25
  • `owlcarousel2/owlcarousel2` looks pretty outdated to me, having seen the last release in 2018. Maybe you should replace it by a more current package? – Nico Haase Jul 25 '22 at 12:00
  • Sorry I wasn't clear. This install _was built from scratch_ on Drupal 9. (I wasn't able to upgrade from 8, so I started from scratch with ```composer create-project drupal/recommended-project my_site```. I've added my composer.json to this question. I didn't install symfony4 -- composer did. I think the issue is that when I install 3rd-party modules, composer installs whatever dependencies the modules call for, and I'm using some modules that /claim/ to be compatible with drupla9, but ultimately it becomes a mess after certain modules are introduced. – 4jag Jul 25 '22 at 12:01
  • Clarification -- This install supports websites that are already built, so I can't just omit modules that are in use. I anticipate folks might say "just start the process again, but leave out X,Y,Z modules - those will cause problems." or "Try to avoid 3rd-party modules for just this reason." I guess I could try to remove site features and modules, but this removes a major benefit of the drupal framework. Are any drupal users resorting to the old style of managing modules via zip/tar files and dropping them in manually, rather than using composer, due to these common problems with composer? – 4jag Jul 25 '22 at 12:50
  • @4jag I think you might not quite be getting the point here. A package that runs under one version of Drupal may not run under a different version. Especially newer versions. As Nico pointed out the carousel package has not been updated since 2018. Very unlikely that it will run under the latest and greatest. Even back in 2018 it looks like it was still under development and never released as being stable. Composer cannot update software. You have other packages installed as alpha, beta etc. All of those are red flags. Why are you trying to upgrade again? – Cerad Jul 25 '22 at 12:58
  • @nico-haas -- The idea of just yanking out random modules because they seem outdated seems like a trial-and-error method of debugging, or even compiling a drupal base and set of modules. (I added owlcarousel2 to composer manually--the only manual change I made--in an attempt to get it to install, but to no avail. I don't think it's the reason for the symfony4 error. Just to be sure, I deleted it and still get same exact error output shown at the top of this post.) – 4jag Jul 25 '22 at 13:06
  • @Cerad -- Yeah, I see what you mean. I'll go back to to the original OwlCarousel. But I'm still stuck on symfony. ((This carousel business is just a side issue, maybe I should have not mentioned it)). Anyway, I'm beginning to suspect that despite many modules /claiming/ to work in ^9, the tests to qualify modules are not very robust (maybe somewhat robust, but less than perfect), and as soon as more than a single module is added all bets are off. Is having 10+ modules installed akin to /Living on the Edge/? – 4jag Jul 25 '22 at 13:15
  • @4jag I created a fresh Drupal 9 project on PHP 8.1 and it turns out that it does indeed use Symfony 4.4 components. So ignore my previous Symfony comment. I was also able to install owlcarousel but not owlcarousel2 which is locked to Drupal 8. I think your plan to stick with the original carousel is probably the best. And maybe stick with Drupal 8. – Cerad Jul 25 '22 at 13:22

0 Answers0