0

After hours of struggling to update Drupal with Composer (see my solution here), I have now some difficulties to update some modules. I was able to update with composer update drupal/bootstrap:3.11 --with-dependencies, but I could not update a module with composer update drupal/pathauto:1.1 --with-dependencies, which returns the following error.

Package "drupal/pathauto:1.1" listed for update is not installed.
Ignoring. Nothing to install or update.

The content of the composer.json file is the following.

{
    "name": "drupal/drupal",
    "description": "Drupal is an open source content management platform powering millions of websites and applications.",
    "type": "project",
    "license": "GPL-2.0+",
    "require": {
        "composer/installers": "^1.0.24",
        "wikimedia/composer-merge-plugin": "^1.4",
        "drupal/views_slideshow": "^4.6",
        "drupal/metatag": "^1.4",
        "drush/drush": "dev-master",
        "drupal/core": "~8.5",
        "drupal/pathauto": "1.1",
        "drupal/bootstrap": "3.11",
        "drupal/token": "1.1"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "preferred-install": "dist",
        "autoloader-suffix": "Drupal8"
    },
    "extra": {
        "_readme": [
            "By default Drupal loads the autoloader from ./vendor/autoload.php.",
            "To change the autoloader you can edit ./autoload.php.",
            "This file specifies the packages.drupal.org repository.",
            "You can read more about this composer repository at:",
            "https://www.drupal.org/node/2718229"
        ],
        "merge-plugin": {
            "include": [
                "core/composer.json"
            ],
            "recurse": false,
            "replace": false,
            "merge-extra": false
        },
        "installer-paths": {
            "core": ["type:drupal-core"],
            "modules/contrib/{$name}": ["type:drupal-module"],
            "profiles/contrib/{$name}": ["type:drupal-profile"],
            "themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/contrib/{$name}": ["type:drupal-drush"],
            "modules/custom/{$name}": ["type:drupal-custom-module"],
            "themes/custom/{$name}": ["type:drupal-custom-theme"]
        }
    },
    "autoload": {
        "psr-4": {
            "Drupal\\Core\\Composer\\": "core/lib/Drupal/Core/Composer"
        }
    },
    "scripts": {
        "pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump",
        "post-autoload-dump": [
          "Drupal\\Core\\Composer\\Composer::ensureHtaccess"
        ],
        "post-package-install": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup",
        "post-package-update": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ]
}

I tried with composer update drupal/token, but it gives the following error.

Nothing to install or update

composer install drupal/token gives the following error.

Invalid argument drupal/token.
Use "composer require drupal/token" instead to add packages to your composer.json.

Instead, composer require drupal/token gives this error

Using version ^1.1 for drupal/token
./composer.json has been updated Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update

I checked the composer.lock file and its content is the following.

    "name": "drupal/token",
    "version": "1.1.0",
    "source": {
        "type": "git",
        "url": "https://git.drupal.org/project/token",
        "reference": "8.x-1.1"
    },

So, it seems thats it is correct, but the module page still shows it as requiring to be updated.

enter image description here

How can I solve this and install these modules?

6
  • composer update drupal/token (drop the version) maybe? I’ve never seen an example of an update which includes the version, thats generally the point of the version in composer.json. Beyond that check composer.lock - does composer definitely believe that package is installed? Maybe your previous solution, which looks heavy-handed, nuked something important. composer install drupal/token might be enough to sync things back up again
    – Clive
    Commented Mar 16, 2018 at 10:24
  • @Clive I've edited my question to answer your comment (see EDIT) Commented Mar 16, 2018 at 11:08
  • 1
    Oh yeah, require not install. There’s not much people can do from here really, you need to check your install to find where the mismatch is. Is it a cache problem? What version of token is actually, physically there in the file system? That sort of thing
    – Clive
    Commented Mar 16, 2018 at 11:10
  • @Clive you're right. So I've checked and token.info.ymlis version: '8.x-1.0'so physically the module is not updated. I will continue pushing on this issue. Thank you anyway for your help. Commented Mar 16, 2018 at 11:17
  • You’ve just got composer confused with the manual stuff :) I’d probably change token to point to the previous version in composer.json (1.0 presumably), then composer update, then change it back to 1.1, then composer update again. That should bring things back in line. There are arguably more elegant ways to do it but brute force is sometimes simplest
    – Clive
    Commented Mar 16, 2018 at 11:23

1 Answer 1

1

I found what was the issue in my case. I post my solution. Even if it is specific to my issue, maybe it could help other users.

I didn’t install these Drupal 8 modules. The developer who installed them used Drush (he should have used Composer). So I had the same modules installed twice, in /module and in modules/contrib I’ve deleted modules previously installed with drush in /module and run composer update. That fixed the problem.

Your Answer

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

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