skip to Main Content

I installed Drupal in one click on a OVH server. First bad surprise: I discovered that the installed version 9.1.9 needs a security update to 9.2.9.

Second bad surprise: drush was not installed by default. So I had to install first composer in order to install drush with the command:

curl -sS https://getcomposer.org/installer | php

After some battles, composer was working. I installed drush issuing command:

composer require --dev drush/drush

Probably, the --dev flag was not necessary.

I see that composer is able to list the available updates of drupal by running:

composer show drupal/recommended-project --all
name     : drupal/recommended-project
descrip. : Project template for Drupal 9 projects with a relocated document root
keywords : 
versions : 9.4.x-dev, 9.3.x-dev, 9.3.0-beta2, 9.3.0-beta1, 9.3.0-alpha1, 9.2.x-dev, 9.2.9, 9.2.8, 9.2.7, 9.2.6, 9.2.5, 9.2.4, 9.2.3, 9.2.2, 9.2.1, 9.2.0, 9.2.0-rc1, 9.2.0-beta3, 9.2.0-beta2, 9.2.0-beta1, 9.2.0-alpha1, 9.1.x-dev, 9.1.14, 9.1.13, 9.1.12, 9.1.11, 9.1.10, 9.1.9, 9.1.8, 9.1.7, 9.1.6, 9.1.5, 9.1.4, 9.1.3, 9.1.2, 9.1.1, 9.1.0, 9.1.0-rc3, 9.1.0-rc2, 9.1.0-rc1, 9.1.0-beta1, 9.1.0-alpha1, 9.0.x-dev, 9.0.14, 9.0.13, 9.0.12, 9.0.11, 9.0.10, 9.0.9, 9.0.8, 9.0.7, 9.0.6, 9.0.5, 9.0.4, 9.0.3, 9.0.2, 9.0.1, 9.0.0, 9.0.0-rc1, 9.0.0-beta3, 9.0.0-beta2, 9.0.0-beta1, 9.0.0-alpha2, 9.0.0-alpha1, 8.9.x-dev, 8.9.20, 8.9.19, 8.9.18, 8.9.17, 8.9.16, 8.9.15, 8.9.14, 8.9.13, 8.9.12, 8.9.11, 8.9.10, 8.9.9, 8.9.8, 8.9.7, 8.9.6, 8.9.5, 8.9.4, 8.9.3, 8.9.2, 8.9.1, 8.9.0, 8.9.0-rc1, 8.9.0-beta3, 8.9.0-beta2, 8.9.0-beta1, 8.8.x-dev, 8.8.12, 8.8.11, 8.8.10, 8.8.9, 8.8.8, 8.8.7, 8.8.6, 8.8.5, 8.8.4, 8.8.3, 8.8.2, 8.8.1, 8.8.0, 8.8.0-rc1, 8.8.0-beta1, 8.8.0-alpha1
type     : project
license  : GNU General Public License v2.0 or later (GPL-2.0-or-later) (OSI approved) https://spdx.org/licenses/GPL-2.0-or-later.html#licenseText
homepage : https://www.drupal.org/project/drupal
source   : [git] https://github.com/drupal/recommended-project.git 7f83a471aca47ffaa981bc8cb8a0cf615163ae5b
dist     : [zip] https://api.github.com/repos/drupal/recommended-project/zipball/7f83a471aca47ffaa981bc8cb8a0cf615163ae5b 7f83a471aca47ffaa981bc8cb8a0cf615163ae5b
names    : drupal/recommended-project

support
chat : https://www.drupal.org/node/314178
docs : https://www.drupal.org/docs/user_guide/en/index.html
source : https://github.com/drupal/recommended-project/tree/9.4.x

requires
composer/installers ^1.9
drupal/core-composer-scaffold ^9.4
drupal/core-project-message ^9.4
drupal/core-recommended ^9.4

requires (dev)
drupal/core-dev ^9.4

conflicts
drupal/drupal *

My problem is that I installed drupal/drupal that is apparently conflicting with drupal/recommended-project where I see the upgrade of drupal I need.

What should be the next step to upgrade from Drupal 9.1.9 to Drupal 9.2.9? Sorry if this question is trivial, but I am overwhelmed with a huge documentation where I get lost.

UPDATE: this is the composer.json file I found in my home directory:

{
    "require-dev": {
        "drush/drush": "^10.6"
    }
}

And UPDATE2: this is the composer.json file I found in the Drupal root directory:

{
    "name": "drupal/legacy-project",
    "description": "Project template for Drupal 9 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",
        "drupal/core-composer-scaffold": "^9.1",
        "drupal/core-project-message": "^9.1",
        "drupal/core-recommended": "^9.1",
        "drupal/core-vendor-hardening": "^9.1"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "stable",
    "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/legacy-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"
            ]
        }
    }
}

2

Answers


  1. If your project is new you can do some actions to be on the last version of drupal.
    To avoid any conflicts you have to :

    rm -rf /vendor
    rm composer.lock (this file fix the versions of your dependencies)
    

    then

    composer update
    

    It will install last version of every dependencies.
    In case if you just want to update drupal dependencies do (without delete composer.lock and /vendor) :

    composer update drupal/core-recommended --with-dependencies
    
    Login or Signup to reply.
  2. I use the inital installation of composer/drush/drupal like this.

    The drush part is the important.

    composer

    PATH=/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php7.4.2/bin:$PATH
      php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
      php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
      php composer-setup.php
      php -r "unlink('composer-setup.php');"
      sudo mv composer.phar /usr/local/bin/composer
      PATH="$(composer config -g home)/vendor/bin:$PATH"
    

    drush

    cd /drushproject/web/
    
    composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader
    
    composer global require consolidation/cgr
    
    cgr drush/drush
    
    # correct DrushLog problems (alternatively run once: drush cr)
    composer require drush/drush
    

    drupal

    drupal --root=/drushproject/web/
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search