0

I just installed drush using "composer require drush/drush". It ran correctly and when it completes a navigate to vendor/drush/drush/ directory where the drush.php file is located

Then I run the following command: php drush.php status and I get the following error:

PHP Fatal error:  Call to undefined method Consolidation\AnnotatedCommand\Hooks\HookManager::getHookOptions() in 
[...]/work/www/EnviePractice/vendor/drush/drush/includes/annotationcommand_adapter.inc on line 475
PHP Stack trace:
PHP   1. {main}() [...]/work/www/EnviePractice/vendor/drush/drush/drush.php:0
PHP   2. drush_main() [...]/work/www/EnviePractice/vendor/drush/drush/drush.php:12
PHP   3. Drush\Boot\BaseBoot->bootstrap_and_dispatch() [...]/work/www/EnviePractice/vendor/drush/drush/includes/preflight.inc:66
PHP   4. drush_dispatch() [...]/work/www/EnviePractice/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php:67
PHP   5. annotationcommand_adapter_add_hook_options() [...]/work/www/EnviePractice/vendor/drush/drush/includes/command.inc:170
Drush command terminated abnormally due to an unrecoverable error.                                                                      [error]
Error: Call to undefined method Consolidation\AnnotatedCommand\Hooks\HookManager::getHookOptions() in
[...]/work/www/EnviePractice/vendor/drush/drush/includes/annotationcommand_adapter.inc, line 475

Can anyone please guide me to what might be causing this?

Additional details:

  1. I am on ubuntu 16.04
  2. Drupal 8 installation
  3. version of drush 8.1
4
  • Could be a permissions issue, could you try to soften the permissions on the vendor/drush folder?
    – mvdgun
    Commented Apr 18, 2017 at 10:02
  • Did you run "composer global update" after install, then "drush init" ? Commented Apr 18, 2017 at 19:48
  • I assume that [...]/work/www/EnviePractice/vendor/consolidation/annotated-command/ exists?
    – hansfn
    Commented Apr 19, 2017 at 10:15
  • If you installed Drupal 8.3 you must use drush 8.1.10 as specified in the release note. drupal.org/project/drupal/releases/8.3.0
    – jBlobsmith
    Commented Apr 19, 2017 at 19:49

1 Answer 1

0

I think your installation or class registry might be broken. Try doing the following things:

  • See if drush rebuild works (if it does not, go to the next point).
  • Go to your Drupal install directory and try to run composer install.
  • If drush rebuild didn't work in the first step, try running it again now.

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.