Unable to upgrade Drupal 9 to Drupal 10

Created on 22 January 2023, almost 2 years ago
Updated 29 November 2023, about 1 year ago

I've been trying to upgrade Drupal 9 to Drupal 10 for days, but nothing works. Unable to update.

Here are the errors in CLI and my composer.json file

I have attached a screenshot of the "Upgrade Status" module report. This is the only error and the PWA module is uninstalled, so I don't understand why this error still appears.

I updated my database, cleared cache, ran a cron job and resaved permissions. It doesn't fix.

How can I upgrade to Drupal 10 ? I am currently on Drupal 9.5.2

uidxxx@od-xxx:~/sites/www.domaine.com$ composer require drupal/core-recommended:10.0.2 drupal/core-composer-scaffold:10.0.2 drupal/core-project-message:10.0.2 --update-with-all-dependencies
./composer.json has been updated
Running composer update drupal/core-recommended drupal/core-composer-scaffold drupal/core-project-message --with-all-dependencies
Gathering patches for root package.
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-recommended 10.0.2 -> satisfiable by drupal/core-recommended[10.0.2].
    - drupal/core-recommended 10.0.2 requires drupal/core 10.0.2 -> found drupal/core[10.0.2] but these were not loaded, likely because it conflicts with another require.


Installation failed, reverting ./composer.json and ./composer.lock to their original content.
uidxxx@od-xxx:~/sites/www.domaine.com$ composer prohibits drupal/core-recommended 10.0.2drupal/recommended-project -      requires         drupal/core-recommended (^9.5)                                
drupal/core-recommended    10.0.2 requires         drupal/core (10.0.2)                                          
drupal/recommended-project -      does not require drupal/core (but 9.5.2 is installed)                          
drupal/core-recommended    10.0.2 requires         asm89/stack-cors (~v2.1.1)                                    
drupal/recommended-project -      does not require asm89/stack-cors (but 1.3.0 is installed)                     
drupal/core-recommended    10.0.2 requires         guzzlehttp/guzzle (~7.5.0)                                    
drupal/recommended-project -      does not require guzzlehttp/guzzle (but 6.5.8 is installed)                    
drupal/core-recommended    10.0.2 requires         guzzlehttp/psr7 (~2.4.3)                                      
drupal/recommended-project -      does not require guzzlehttp/psr7 (but 1.9.0 is installed)                      
drupal/core-recommended    10.0.2 requires         psr/cache (~3.0.0)                                            
drupal/recommended-project -      does not require psr/cache (but 1.0.1 is installed)                            
drupal/core-recommended    10.0.2 requires         psr/container (~2.0.2)                                        
drupal/recommended-project -      does not require psr/container (but 1.1.2 is installed)                        
drupal/core-recommended    10.0.2 requires         psr/log (~3.0.0)                                              
drupal/recommended-project -      does not require psr/log (but 1.1.4 is installed)                              
drupal/core-recommended    10.0.2 requires         symfony/console (~v6.2.2)                                     
drupal/recommended-project -      does not require symfony/console (but v4.4.49 is installed)                    
drupal/core-recommended    10.0.2 requires         symfony/dependency-injection (~v6.2.2)                        
drupal/recommended-project -      does not require symfony/dependency-injection (but v4.4.49 is installed)       
drupal/core-recommended    10.0.2 requires         symfony/deprecation-contracts (~v3.1.1)                       
drupal/recommended-project -      does not require symfony/deprecation-contracts (but v2.5.2 is installed)       
drupal/core-recommended    10.0.2 requires         symfony/error-handler (~v6.2.2)                               
drupal/recommended-project -      does not require symfony/error-handler (but v4.4.44 is installed)              
drupal/core-recommended    10.0.2 requires         symfony/event-dispatcher (~v6.2.2)                            
drupal/recommended-project -      does not require symfony/event-dispatcher (but v4.4.44 is installed)           
drupal/core-recommended    10.0.2 requires         symfony/event-dispatcher-contracts (~v3.1.1)                  
drupal/recommended-project -      does not require symfony/event-dispatcher-contracts (but v1.1.13 is installed) 
drupal/core-recommended    10.0.2 requires         symfony/http-foundation (~v6.2.2)                             
drupal/recommended-project -      does not require symfony/http-foundation (but v4.4.49 is installed)            
drupal/core-recommended    10.0.2 requires         symfony/http-kernel (~v6.2.2)                                 
drupal/recommended-project -      does not require symfony/http-kernel (but v4.4.49 is installed)                
drupal/core-recommended    10.0.2 requires         symfony/mime (~v6.2.2)                                        
drupal/recommended-project -      does not require symfony/mime (but v5.4.13 is installed)                       
drupal/core-recommended    10.0.2 requires         symfony/process (~v6.2.0)                                     
drupal/recommended-project -      does not require symfony/process (but v4.4.44 is installed)                    
drupal/core-recommended    10.0.2 requires         symfony/routing (~v6.2.0)                                     
drupal/recommended-project -      does not require symfony/routing (but v4.4.44 is installed)                    
drupal/core-recommended    10.0.2 requires         symfony/serializer (~v6.2.2)                                  
drupal/recommended-project -      does not require symfony/serializer (but v4.4.47 is installed)                 
drupal/core-recommended    10.0.2 requires         symfony/service-contracts (~v3.1.1)                           
drupal/recommended-project -      does not require symfony/service-contracts (but v2.5.2 is installed)           
drupal/core-recommended    10.0.2 requires         symfony/translation-contracts (~v3.1.1)                       
drupal/recommended-project -      does not require symfony/translation-contracts (but v2.5.2 is installed)       
drupal/core-recommended    10.0.2 requires         symfony/validator (~v6.2.2)                                   
drupal/recommended-project -      does not require symfony/validator (but v4.4.48 is installed)                  
drupal/core-recommended    10.0.2 requires         symfony/var-dumper (~v6.2.2)                                  
drupal/recommended-project -      does not require symfony/var-dumper (but v5.4.17 is installed)                 
drupal/core-recommended    10.0.2 requires         symfony/yaml (~v6.2.2)                                        
drupal/recommended-project -      does not require symfony/yaml (but v4.4.45 is installed)                       
drupal/core-recommended    10.0.2 requires         twig/twig (~v3.5.0)                                           
drupal/recommended-project -      does not require twig/twig (but v2.15.4 is installed)                          
Not finding what you were looking for? Try calling `composer update "drupal/core-recommended:10.0.2" --dry-run` to get another view on the problem.
uidxxx@od-xxx:~/sites/www.domaine.com$ composer update "drupal/core-recommended:10.0.2" --dry-run
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-recommended ^9.5, found drupal/core-recommended[9.5.0, 9.5.1, 9.5.2] but it conflicts with your temporary update constraint (drupal/core-recommended:10.0.2).

composer.json

{
    "name": "drupal/recommended-project",
    "description": "Project template for Drupal projects with composer following drupal/drupal layout",
    "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": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "composer/installers": "^1.9",
        "cweagans/composer-patches": "^1.7",
        "drupal/adsense": "^1.4@RC",
        "drupal/allowed_formats": "^2.0",
        "drupal/antibot": "^2.0",
        "drupal/better_social_sharing_buttons": "^4.0",
        "drupal/core-composer-scaffold": "^9.5",
        "drupal/core-project-message": "^9.5",
        "drupal/core-recommended": "^9.5",
        "drupal/core-vendor-hardening": "^9.5",
        "drupal/diff": "^1.1",
        "drupal/easy_breadcrumb": "^2.0",
        "drupal/editor_advanced_link": "^2.1",
        "drupal/eu_cookie_compliance": "^1.24",
        "drupal/matomo": "^1.20",
        "drupal/menu_breadcrumb": "^1.16",
        "drupal/metatag": "^1.22",
        "drupal/native_lazy_loading": "^1.1@RC",
        "drupal/pathauto": "^1.11",
        "drupal/redirect": "^1.8",
        "drupal/schema_metatag": "^2.4",
        "drupal/scroll_top_button": "^2.0",
        "drupal/search404": "^2.1",
        "drupal/simple_sitemap": "^4.1",
        "drupal/views_infinite_scroll": "^2.0",
        "drush/drush": "^11.4"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "stable",
    "prefer-stable": true,
    "config": {
        "allow-plugins": {
            "composer/installers": true,
            "drupal/core-composer-scaffold": true,
            "drupal/core-project-message": true,
            "drupal/core-vendor-hardening": true,
            "phpstan/extension-installer": true,
            "dealerdirect/phpcodesniffer-composer-installer": true,
            "cweagans/composer-patches": true
        },
        "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"
            ]
        },
        "patches": {
            "drupal/menu_breadcrumb": {
                "Automated Drupal 10 compatibility fixes": "https://www.drupal.org/files/issues/2022-11-22/menu_breadcrumb-drupal_10_compat-3297634-4.patch"
            }
        },
        "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/legacy-project template!               </>",
                "<bg=blue;fg=white>                                                         </>",
                "",
                "<bg=yellow;fg=black>Next steps</>:",
                "  * Install the site: https://www.drupal.org/docs/installing-drupal",
                "  * 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"
            ]
        }
    }
}
๐Ÿ’ฌ Support request
Status

Fixed

Version

10.0 โœจ

Component
Composerย  โ†’

Last updated 4 days ago

No maintainer
Created by

๐Ÿ‡ซ๐Ÿ‡ทFrance zenimagine

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

Comments & Activities

  • Issue created by @zenimagine
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States mfb San Francisco

    composer why-not drupal/core ^10 shows you have at least one project that doesn't have a drupal 10 release yet, drupal/menu_breadcrumb

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance zenimagine

    @mfb I just uninstalled the module, now I have this error and the update is not done :

    Your requirements could not be resolved to an installable set of packages.

    Problem 1
    - Root composer.json requires drupal/core-recommended 10.0.2 -> satisfiable by drupal/core-recommended[10.0.2].
    - drupal/core-recommended 10.0.2 requires psr/log ~3.0.0 -> found psr/log[3.0.0] but these were not loaded, likely because it conflicts with another require.

    Installation failed, reverting ./composer.json and ./composer.lock to their original content.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States mfb San Francisco

    For me the easiest thing is to get a list of requirements: composer show --no-dev --direct --name-only | xargs

    and then use this to generate a new set of requirements, with minimal specification of versions so composer can figure out whatever works:

    composer require composer/installers cweagans/composer-patches drupal/adsense:@RC drupal/allowed_formats drupal/antibot drupal/better_social_sharing_buttons drupal/core-composer-scaffold drupal/core-project-message drupal/core-recommended drupal/core-vendor-hardening drupal/diff drupal/easy_breadcrumb drupal/editor_advanced_link drupal/eu_cookie_compliance drupal/matomo drupal/metatag drupal/native_lazy_loading:@RC drupal/pathauto drupal/redirect drupal/schema_metatag drupal/scroll_top_button drupal/search404 drupal/simple_sitemap drupal/views_infinite_scroll drush/drush --update-with-all-dependencies

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance zenimagine

    Thank you it works the solution and remove drush

  • Status changed to Fixed almost 2 years ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States mfb San Francisco

    Does drupal.org have any documentation on doing this? If not, I think we should add some.

    If I recall correctly, composer's --update-with-all-dependencies option only updates dependencies of the things you are requiring. So you need to require all your requires, such that they and all their dependencies can be updated, not just drupal core.

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed almost 2 years ago
  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark ressa Copenhagen

    It looks to me like the psr/log ~3.0.0 conflict is mainly a Drush issue so I have created Can't update from Drupal 9 to Drupal 10 with Drush installed #5461.

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark ressa Copenhagen

    @weitzman helped me realize that this is the correct method to upgrade a Composer-based site from Drupal to Drupal 10: https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-... โ†’

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States mfb San Francisco

    @ressa I've seen those existing docs, but they don't mention that some projects will need to "require all their requires," as I described in #8 and #5 - i.e. those docs don't cover edge cases such as this issue.

    With the above composer.json file in place, I tried the various documented commands such as requiring drupal 10 with the --no-update option and then running composer update, but that gave me the same "Your requirements could not be resolved to an installable set of packages" reported in the issue summary (confirmed with both composer 2.5.4 and composer 2.4.1)

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark ressa Copenhagen

    @mfb My Composer skills are extremely limited (where's https://www.drupal.org/u/mmjvb โ†’ ?) so I can't really offer any help ... I am mostly just trying out the existing documentation, and trying to see if it works.

    I hope you figure it out, and share it in the documentation pages if you do.

    Also, since this issue is closed, perhaps you could consider opening a fresh issue, dedicated to solving your challenge?

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States mfb San Francisco

    It's not my challenge and my solution is already here in #5 - I'm inquiring if the community has already documented this someplace or if I should add it to the existing documentation. Seems like maybe it's undocumented and I should add it.

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark ressa Copenhagen

    Sorry, I didn't mean to offend you.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States mfb San Francisco

    Ok I added a paragraph to https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-... โ†’

    @ressa not offended at all :D just trying to figure out how we could improve the documentation on this

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark ressa Copenhagen

    Perfect, thanks for documenting it. Have a nice day!

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada sseto

    @mfb. Thanks for creating the document. I used it and it fixed my issues!

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom joachim

    This needs to be re-opened, because the instructions at https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-... โ†’ are insane. People expect Composer updates to work - instead you need to google and eventually land on an arcane set of steps.

    > We use --no-update to avoid a chicken-and-egg problem with mutual dependencies:

    What is the cause of the mutual dependency?

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark ressa Copenhagen

    I agree @joachim, it ought to be easier. It is based on the page https://www.drupal.org/docs/upgrading-drupal/drupal-8-and-higher โ†’ , see the discussion โ†’ .

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada Charlie ChX Negyesi ๐ŸCanada

    I documented how I did it: https://drupalusbcandmore.blot.im/d10up

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom joachim

    I installed a D9 site following the steps at https://ddev.readthedocs.io/en/latest/users/quickstart/#drupal

    I then did: `composer require -W drupal/core-recommended ^10`

    Output:

    ./composer.json has been updated
    Running composer update drupal/core-recommended --with-all-dependencies
    Loading composer repositories with package information
    Updating dependencies
    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - drupal/core-recommended[10.0.0, ..., 10.1.5] require psr/log ~3.0.0 -> found psr/log[3.0.0] but these were not loaded, likely because it conflicts with another require.
        - Root composer.json requires drupal/core-recommended ^10 -> satisfiable by drupal/core-recommended[10.0.0, ..., 10.1.5].
    
    

    I appreciate that several of people have figured out some steps to make this work, but my point is that these complex steps should not be necessary. Something is wrong: either in Drupal, or in Composer.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States mfb San Francisco

    It certainly would be neat if someone worked on a new composer command to update all your dependencies to new major versions, even without specifying them, but currently you have to explicitly require them for that to happen (as I attempted to document)

  • There has been widespread confusion and complications with these upgrades, and the situation is not improving.

  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland berdir Switzerland

    A separate issue was opened for this and I replied there: ๐Ÿ’ฌ Upgrading Drupal core to a new major version is very difficult when Drush is also installed Active

    For those coming here and getting errors despite following the documentation and are stuck, I put together a post where I outlined my process, maybe that helps you: https://md-systems.notion.site/Major-Drupal-upgrades-with-composer-68c8c.... If even that doesn't help, then I recommend you ask in Slack in #d10readiness and share your composer.json or at least a version of it that allows to reproduce your problem if there are parts in it that you don't want to share.

    I also made a small edit to the documentation page to make the steps slightly less complex, that is removing the --update-with-dependencies for composer --require. That does nothing when combined with --no-update, those are instructions for the implied composer update command that is skipped anyway.

    Feel free to include more of my notes into the documentation page, I didn't want to make further non-trivial changes there.

    In Slack, we also discussed that drupal/core-recommended is causing more problems than it solves and we might want to re-evaluate if we really want to keep recommending that. I never use it on our projects.

  • ๐Ÿ‡บ๐Ÿ‡ฆUkraine SerShevchyk Lutsk

    @Berdir I think you can add a command to step 3 in your documentation:

    composer require --no-update drupal/core:^10.1 drupal/core-composer-scaffold:^10.1 drupal/core-project-message:^10.1

  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland berdir Switzerland

    No I specifically didn't do that. I like how Symfony does it in https://symfony.com/doc/current/setup/upgrade_major.html#2-update-to-the.... It doesn't give you an exact command because much more so for Symfony than Drupal, those packages aren't going to be the same for every project. I don't use project-message in my projects, and people might still have legacy projects, where they need to update vendor hardening and that require command would add scaffold as a new dependency which might just break stuff.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States maxstarkenburg Washington, DC

    What are the recommended steps if one wants to avoid running composer update sans arguments?

    Since that updates everything, it also includes directly-required contrib, and I don't want my update of core to be accompanied by the regressions I've found in the latest patch releases of stage_file_proxy and viewsreference, for example.

    I know I can lock those two specific modules at specific versions, but I also don't want to have to wonder what other contrib's updates might have regressions, require time testing, etc. (whereas any regressions in core's dependencies will naturally have more eyeballs encountering them than contrib). Nor do I want to have to do manual git add -p composer.lock of course.

  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland berdir Switzerland

    Well, you can try to explicitly list every single dependency that composer update -W foo bar baz but that's going to be *very* tedious with likely a lot of very confusing composer errors. The reality is that every contrib module needs to be updated to a version that is compatible with Drupal 10, and depending on how frequently you update, that will end up requiring to update basically everything anyway and there is no way around that.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia rohan_singh India

    As per the documentation
    https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-... โ†’

    When we are upgrading only the core modules, with using
    composer update "drupal/core-*" drush/drush --with-all-dependencies --dry-run

    I am getting psr/log issues.
    - Root composer.json requires drupal/core-recommended 10.0.11 -> satisfiable by drupal/core-recommended[10.0.11].
    - drupal/core-recommended 10.0.11 requires psr/log ~3.0.0 -> found psr/log[3.0.0] but these were not loaded, likely because it conflicts with another require.

Production build 0.71.5 2024