drupal-composer/drupal-project

How to update Drupal Core ?

SebastienGicquel opened this issue ยท 7 comments

Hello,

I'm using this template for the 1st time.

I wanted to update (actually Drupal core 9.0.10) and need to update to 9.1.0 (2020-Dec-02) and 9.1.0-rc3 (2020-Nov-26).

I've ran composer update drupal/core-recommended drupal/core-dev --with-dependencies to update Drupal Core and its dependencies.

But I still see the pending update in UI after.

Here is what I have in terminal

$ composer update drupal/core-recommended drupal/core-dev --with-dependencies
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 23 updates, 0 removals
  - Updating drupal/core (9.0.9 => 9.0.10): Downloading (100%)         
  - Updating drupal/core-recommended (9.0.9 => 9.0.10)
  - Updating sebastian/type (1.1.3 => 1.1.4): Downloading (100%)         
  - Updating sebastian/resource-operations (2.0.1 => 2.0.2): Downloading (100%)         
  - Updating sebastian/recursion-context (3.0.0 => 3.0.1): Downloading (100%)         
  - Updating sebastian/object-reflector (1.1.1 => 1.1.2): Downloading (100%)         
  - Updating sebastian/object-enumerator (3.0.3 => 3.0.4): Downloading (100%)         
  - Updating sebastian/global-state (3.0.0 => 3.0.1): Downloading (100%)         
  - Updating sebastian/exporter (3.1.2 => 3.1.3): Downloading (100%)         
  - Updating sebastian/environment (4.2.3 => 4.2.4): Downloading (100%)         
  - Updating sebastian/diff (3.0.2 => 3.0.3): Downloading (100%)         
  - Updating sebastian/comparator (3.0.2 => 3.0.3): Downloading (100%)         
  - Updating phpunit/php-timer (2.1.2 => 2.1.3): Downloading (100%)         
  - Updating phpunit/php-file-iterator (2.0.2 => 2.0.3): Downloading (100%)         
  - Updating sebastian/code-unit-reverse-lookup (1.0.1 => 1.0.2): Downloading (100%)         
  - Updating phpunit/php-token-stream (3.1.1 => 4.0.4): Downloading (100%)         
  - Updating phpunit/php-code-coverage (7.0.12 => 7.0.14): Downloading (100%)         
  - Updating phar-io/version (2.0.1 => 3.0.3): Downloading (100%)         
  - Updating phar-io/manifest (1.0.3 => 2.0.1): Downloading (100%)         
  - Updating phpunit/phpunit (8.5.11 => 8.5.13): Downloading (100%)         
  - Updating composer/spdx-licenses (1.5.4 => 1.5.5): Downloading (100%)         
  - Updating composer/composer (1.10.17 => 1.10.18): Downloading (100%)         
  - Updating drupal/core-dev (9.0.9 => 9.0.10)
Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested. 

Do I need to run "composer update " also ? Is it a bug or Did I miss something ?

Can you maybe add you composer.json and reopen the issue if you not already figured it out yourself? Maybe also try composer update "drupal/core-*" --with-dependencies next time.

@leymannx Thanks, I didn't figure it out.

So composer update "drupal/core-*" --with-dependencies solved my issue.

@leymannx Here is my composer.json after update ๐Ÿ‘

{
    "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",
        "composer/installers": "^1.9",
        "cweagans/composer-patches": "^1.7",
        "drupal/adminimal_admin_toolbar": "^1.11",
        "drupal/adminimal_theme": "^1.6",
        "drupal/blazy": "^2.1",
        "drupal/bootstrap_barrio": "^5.1",
        "drupal/bootstrap_sass": "^5.0",
        "drupal/codesnippet": "^1.7",
        "drupal/core-composer-scaffold": "^9.0",
        "drupal/core-recommended": "^9.0",
        "drupal/field_group": "^3.1",
        "drupal/honeypot": "^2.0",
        "drupal/linkit": "^6.0@beta",
        "drupal/metatag": "^1.14",
        "drupal/pathauto": "^1.8",
        "drupal/redirect": "^1.6",
        "drupal/save_edit": "^1.3",
        "drupal/swiftmailer": "^2.0@beta",
        "drupal/webform": "^6.0@beta",
        "drupal/webp": "^1.0@beta",
        "drush/drush": "^10.3",
        "vlucas/phpdotenv": "^5.1",
        "webflo/drupal-finder": "^1.2"
    },
    "require-dev": {
        "drupal/core-dev": "^9.0",
        "zaporylie/composer-drupal-optimizations": "^1.2"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "discard-changes": true,
        "sort-packages": 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": {
        }
    }
}

So you now updated successfully?

@leymannx yes I've updated successfully with the command you gave me but don't understand why the command that is in the doc composer update drupal/core-recommended drupal/core-dev --with-dependencies doesn't work.

Do you see something wrong in my composer.json ?

Nothing wrong, but there's also the drupal/core-composer-scaffold dependency. Maybe this one prevented the update. With the wildcard in the command I gave you, we pick this up as well. I think I'll update the docs on that now.

This doesn't work for me. I have a 9.2.8 site installed. The command composer update "drupal/core-*" --with-dependencies runs without errors, but instead of updating to 9.3.11 my site remains on 9.2.8.

Update
Ok, fixed with composer update drupal/core "drupal/core-*" --with-dependencies
Running updatedb threw a core error for me after that but there is a patch here: https://www.drupal.org/project/drupal/issues/2957376