1

I recently nstalled Drush using composer global require drush/drush:dev-master and it got installed successfully.

I ran command which drush and the terminal gave me /home/ravi/.composer/vendor/bin/drush.

I am not able to execute any command from the project root. I get this error.

PHP Fatal error: Cannot redeclare composerRequireDrupal8() (previously declared in /var/lib/composer/vendor/composer/autoload_real.php:63) in /var/www/html/study/drupal/8/vendor/composer/autoload_real.php on line 70

But when I /home/ravi/.composer/vendor/bin/drush status, then Drush works perfectly well.

Is there any way to use Drush from the project root?

PS: I have tried updating Composer, but it didn't help.

1 Answer 1

0

Please do not install Drush using composer global require.

Quoted from http://docs.drush.org/en/8.x/install-alternative/.

If you have Drupal 8 installed conventionally best practice would be to install Drush 8 globally by downloading the latest drush.phar, see http://docs.drush.org/en/8.x/install/.

If your Drupal 8 site is composer based then Drush 9 is probably already included. If not see http://docs.drush.org/en/master/install/.

2
  • So you mean, we should put drush.phar at the root of the project and use the same for routine stuff? May 17, 2018 at 18:24
  • Yes, you can do this, but normally you place the phar file where it can be executed globally as described in the documentation.
    – 4uk4
    May 17, 2018 at 18:38

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.