Drupal 8 - Drush composerRequireDrupal8 error

by Ravi Maniyar   Last Updated May 15, 2018 18:07 PM

System: Ubuntu 14.x

Drupal: 8.x

Drush: 8.x

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

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

The problem is, I am not able to execute any commands from project root. It gives me below 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 execute below command from project root:

/home/ravi/.composer/vendor/bin/drush status

then Drush works perfectly well.

Is there any way I can use Drush from project root? Or have I made any mistakes in installation? Please help.

PS: I have tried updating composer and composer self-update but it did not help.

Tags : 8 drush composer

Related Questions

drush 7.3 is not working

Updated July 16, 2016 08:03 AM

Freshly installed Drush is unresponsive

Updated May 12, 2016 08:03 AM

Add/Fix composer in an ongoing project

Updated June 07, 2017 09:07 AM

How to install drush 8 properly on Debian 8?

Updated June 16, 2015 03:03 AM