When I run

drush --version

I get next output:

count(): Parameter must be an array or an object that implements     [warning]
Countable Table.php:789
 Drush Version   :  7.4.0 

For getting rid of the warning, I have been told I to install drush version 8. So I issued:

composer require drush/drush:8

giving next result:

./composer.json has been updated
Running composer update drush/drush
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
9 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

So I suppose drush was already at version 8, but issuing the command above, I still have the same result: version 7.4.0. I am probably messing with several versions of drush.

I would like to understand better how to get rid of the old version, and being sure I am using the last one.


2 Answers 2


You are mixing up the globally installed Drush with a locally installed Drush. To run the local Drush from your project, run vendor/drush/drush/drush --version from inside your project. This will give you 8.0.0 which is a bit old. Better get the latest Drush 8 release with composer require drush/drush:^8. Currently this is Drush 8.4.8.

Next, you can consider to either update the globally installed Drush (not recommended) composer global require drush/drush:^8 or alternatively (recommended) install the Drush Launcher instead. The Drush Launcher is just a wrapper command to always pick up the project-local Drush. So you can easily run Composer-based D7 and D8/D8+ projects on the same machine in parallel and calling drush --version in a project will adjust accordingly.

If your project is D8 or D9 install Drush 10 instead composer require drush/drush.


This is how I solved my problem after trying a lot of things to upgrade composer and drush and finally crashing completely:

cd $HOME                                           # the current directory must be $HOME
rm -rf .composer                                   # remove all composer packages 
curl -s https://getcomposer.org/installer | php    # install composer in $HOME
sudo mv composer.phar /usr/bin/composer            # move composer from local to global 
composer -W global require drush/drush:^8.4        # install the version of drush I need


After this, the executable composer.phar is renamed to composer. So do not longer look at $HOME/composer.phar if you ever want to uninstall it. You will just have to delete /usr/bin/composer.

Check your $PATH: $HOME/.config/composer/vendor/bin must be included. Caution: some configurations have $HOME/.composer/vendor/bin in the $PATH variable, which is also possible, but you need to keep it coherent with the place where the packages are installed.

  • Where is the (global) executable of drush? Apr 27, 2021 at 13:55
  • 1
    ~/.composer/vendor/drush/drush/drush and I think a symlink at ~/.composer/vendor/bin/drush. Most people add ~/.composer/vendor/bin to their $PATH.
    – leymannx
    Apr 27, 2021 at 22:06
  • I found it in ~/.config/composer/vendor/bin with a symlink to ../drush/drush/drush, i.e. ~/.config/composer/vendor/drush/drush/drush Apr 28, 2021 at 6:57

Your Answer

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

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