• Support
  • How to install drush for Drupal 7

managed to installed, but still not working:

[valrob@opal6 admin]$ ./vendor/bin/drush --version
Drush Commandline Tool 10.3.6
[valrob@opal6 admin]$ ./vendor/bin/drush cc

In CheckExceptionOnInvalidReferenceBehaviorPass.php line 31:


The service "config.import.commands" has a dependency on a non-existent service "extension.list.module".


cache:clear [--cache-clear [CACHE-CLEAR]] [--no-cache-clear] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-d|--debug] [-y|--yes] [--no] [--remote-host REMOTE-HOST] [--remote-user REMOTE-USER] [-r|--root ROOT] [-l|--uri URI] [--simulate] [--pipe] [-D|--define DEFINE] [--druplicon] [--notify [NOTIFY]] [--xh-link XH-LINK] [--] <command> <type> [<args>]...

  • sean replied to this.

    josueValrob I think you've got some kind of version mismatch between some combination of PHP, Drupal, drush and/or composer.

      7 months later
      4 months later

      How would I install drush for an existing installation of Drupal 7 (like one that was ported over from webfaction).

      I have been singularly unsuccessful at installing the correct version of drush (one that is compatible with Drupal 7 (like 8.4.8).

      I've mucked something up, but I'm not sure exactly how. The version of drush that runs outside of the app directory is 8.4.8 and seems a little broken. The version of drush that runs inside my app directory is 10.6.1 (not compatible with Drupal 7.

      How do I fix this?

      I want to run drush 8.4.8 everywhere (it's compatible with most versions of Drupal I use).

      The installation instructions here are quite opaque.

      Thanks in advance,
      Dave

      • sean replied to this.

        kabal to install Drush 8.4.8, go into whichever app directory and run:

        composer require drush/drush:8.4.8

          sean

          `
          [kabal@opal4 rescueminute]$ composer require drush/drush:8.4.8
          ./composer.json has been updated
          Running composer update drush/drush
          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 drush/drush 8.4.8 -> satisfiable by drush/drush[8.4.8].
          - drush/drush 8.4.8 requires consolidation/annotated-command 2.12.0 -> found consolidation/annotated-command[2.12.0, 2.12.1] but the package is fixed to 4.4.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

          Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

          Installation failed, reverting ./composer.json and ./composer.lock to their original content.
          [kabal@opal4 rescueminute]$
          `

          Cheers,
          Dave

          • sean replied to this.

            kabal you could try a standalone installation like so:

            mkdir ~/drush
            cd ~/drush
            composer require drush/drush:8.4.8
            export PATH=$HOME/drush/vendor/bin:$PATH

            This will give you a single drush installed in ~/drush that you can use with whatever Drupal 7 sites you have.

              sean Installation above worked perfectly. Refuses to use the correct version.

              [kabal@opal4 rescueminute]$ which drush
              ~/drush/vendor/bin/drush
              [kabal@opal4 rescueminute]$ drush status
              PHP binary : /usr/bin/php
              PHP config : /etc/php.ini
              PHP OS : Linux
              Drush script : /home/kabal/apps/rescueminute/vendor/drush/drush/drush
              Drush version : 10.6.1
              Drush temp : /tmp
              Drush configs : /home/kabal/apps/rescueminute/vendor/drush/drush/drush.y
              ml

              OK SOMETHING is working. I deleted the vendor/drush directory.

              Every drush command produces the following error, but seems to succeed:

              [kabal@opal4 rescueminute]$ drush up
              sh: module: line 1: syntax error: unexpected end of file
              sh: error importing function definition for 'BASH_FUNC_module'

              OR

              [kabal@opal4 rescueminute]$ drush status
              sh: module: line 1: syntax error: unexpected end of file
              sh: error importing function definition for 'BASH_FUNC_module'

              So.... progress.

              • sean replied to this.

                sean Awesome, the second one worked (first one not so much).

                a year later

                kabal It looks like composer is either not installed or not included in your PATH. You might need to restart your SSH terminal session after installing composer, or just use the path in the command when running it, eg.
                ~/bin/composer require drush/drush:8.4.8

                a year later

                sean after reading this, I downgraded Drush from 10 to 9 on my Drupal 8 site with PHP 7.3, it worked perfectly. Thank you!

                Mastodon