0

I included drush in the composer.json file, when I try to run any drush command, an error comes up saying drush must be version 8 to work and the current version is 7. when I run composer update OR composer update drush/drush, The command stuck at "Updating dependencies"


Current composer.json file:

{
    "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",
        "drush/drush": "^8.1"
    },
    "replace": {
        "drupal/core": "~8.3"
    },
    "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"
        }
    ]
}

Using -vvv in composer command this is the last lines in the cmd, looks like the command is infinite looping

Downloading http://packagist.org/p/drupal/serialization%2486c49f607a3408726c6a55dc4380d63f92adfda992e89e627881d7e751d5002f.json
Writing /cygdrive/c/Users/Bassem mohamed/.composer/cache/repo/https---packagist.org/provider-drupal$serialization.json into cache
Downloading http://packagist.org/p/drupal/seven%24f9f8a58738e89d376dc474de5a64e1b2fc67b948a450c4b9d9bcfdd40c7b7b73.json
Writing /cygdrive/c/Users/Bassem mohamed/.composer/cache/repo/https---packagist.org/provider-drupal$seven.json into cache
Downloading http://packagist.org/p/drupal/shortcut%24f9f8a58738e89d376dc474de5a64e1b2fc67b948a450c4b9d9bcfdd40c7b7b73.json
Writing /cygdrive/c/Users/Bassem mohamed/.composer/cache/repo/https---packagist.org/provider-drupal$shortcut.json into cache
Downloading http://packagist.org/p/drupal/simpletest%249fe102fcb971cbefe3cf8fa385b8399e4aceecad62b556b70a855d830ab18b77.json
Writing /cygdrive/c/Users/Bassem mohamed/.composer/cache/repo/https---packagist.org/provider-drupal$simpletest.json into cache
Downloading http://packagist.org/p/drupal/standard%249e90fe991f2b31fba242edf7d8d4e53c62906aeccfd6206ec9142f01af9cb452.json
Writing /cygdrive/c/Users/Bassem mohamed/.composer/cache/repo/https---packagist.org/provider-drupal$standard.json into cache
Downloading http://packagist.org/p/drupal/stark%24f9f8a58738e89d376dc474de5a64e1b2fc67b948a450c4b9d9bcfdd40c7b7b73.json
Writing /cygdrive/c/Users/Bassem mohamed/.composer/cache/repo/https---packagist.org/provider-drupal$stark.json into cache
Downloading http://packagist.org/p/drupal/statistics%24f9f8a58738e89d376dc474de5a64e1b2fc67b948a450c4b9d9bcfdd40c7b7b73.json
Writing /cygdrive/c/Users/Bassem mohamed/.composer/cache/repo/https---packagist.org/provider-drupal$statistics.json into cache
Downloading http://packagist.org/p/drupal/syslog%24f9f8a58738e89d376dc474de5a64e1b2fc67b948a450c4b9d9bcfdd40c7b7b73.json
Writing /cygdrive/c/Users/Bassem mohamed/.composer/cache/repo/https---packagist.org/provider-drupal$syslog.json into cache
Downloading http://packagist.org/p/drupal/system%24f9f8a58738e89d376dc474de5a64e1b2fc67b948a450c4b9d9bcfdd40c7b7b73.json
Writing /cygdrive/c/Users/Bassem mohamed/.composer/cache/repo/https---packagist.org/provider-drupal$system.json into cache
Downloading http://packagist.org/p/drupal/taxonomy%24f9f8a58738e89d376dc474de5a64e1b2fc67b948a450c4b9d9bcfdd40c7b7b73.json
Writing /cygdrive/c/Users/Bassem mohamed/.composer/cache/repo/https---packagist.org/provider-drupal$taxonomy.json into cache
Downloading http://packagist.org/p/drupal/telephone%2486c49f607a3408726c6a55dc4380d63f92adfda992e89e627881d7e751d5002f.json
Writing /cygdrive/c/Users/Bassem mohamed/.composer/cache/repo/https---packagist.org/provider-drupal$telephone.json into cache
Downloading http://packagist.org/p/drupal/text%24f9f8a58738e89d376dc474de5a64e1b2fc67b948a450c4b9d9bcfdd40c7b7b73.json
  • Usually that means you need to throw more processor power at your server. Composer is a hungry, hungry beast for complicated projects – Clive Sep 18 '17 at 10:42
  • What does it say when you do which drush? – Beebee Sep 18 '17 at 10:52
  • Which is not working in PowerShell !!, I am trying a different approach, Using Cygwin. I am having trouble also, running Drush from Cygwin gives an error of no such file require ( ...../vendor/bin/includes/bootstrap.inc ), running " composer require drush " from Cygwin gives an error ( Call to undefined function Symfony\Polyfill\Mbstring\iconv() ), While running " Which Drush " gives ( /usr/bin/drush ) I am very confused the output from the same commands in Cygwin terminal is very different in PowerShell FYI: I am using windows 10 – Bassem Mohamed Sep 19 '17 at 9:59
  • @BassemMohamed Sorry not even aware of a thing called PowerShell. Basically from what I read in the original question, I think you have a few instances of Drush scattered around in your system. I believe composer will install in ./vendor/bin/drush (Or in your home directory ~/.composer/vendor/bin/drush). which drush saying /usr/bin/drush means that the drush binary located there is being used instead of the one that composer installed, and no matter how many times you update it using composer, it won't update the one in /usr/bin/drush. – Beebee Sep 19 '17 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.