2

I have multiple sites inside the same htdocs directory. In one, I removed all the folders except vendor under Web. Now drush will not work (it worked before I moved the folders). But now, it cannot find the database, which is correctly defined in web/sites/default/settings.php

/srv/www/htdocs/jar/drupal # ./drush status
 PHP binary    : /usr/bin/php
 PHP config    : /srv/www/php.ini
 PHP OS        : Linux
 Drush script  : /srv/www/htdocs/jar/drupal/vendor/drush/drush/drush
 Drush version : 10.3.6
 Drush temp    : /tmp
 Drush configs : /srv/www/htdocs/jar/drupal/vendor/drush/drush/drush.yml
 Drupal root   : /srv/www/htdocs/jar/drupal

I am running Drupal 9.0.8 and drush 10.3.6 (in /srv/www/htdocs/jar/drupal). I have removed drush using composer (2.0.3) and reinstalled it (recreating vendor in the process).

/srv/www/htdocs/jar/drupal # ./drush -vvv cr
 [preflight] Config paths: /srv/www/htdocs/jar/drupal/vendor/drush/drush/drush.yml
 [preflight] Alias paths: /srv/www/htdocs/jar/drupal/drush/sites,/srv/www/htdocs/jar/drush/sites
 [preflight] Commandfile search paths: /srv/www/htdocs/jar/drupal/vendor/drush/drush/src
 [debug] Starting bootstrap to site [0.04 sec, 8.17 MB]

In BootstrapHook.php line 32:
  [Exception]
  Bootstrap failed. Run your command with -vvv for more information.
Exception trace:
  at /srv/www/htdocs/jar/drupal/vendor/drush/drush/src/Boot/BootstrapHook.php:32
 Drush\Boot\BootstrapHook->initialize() at /srv/www/htdocs/jar/drupal/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:44
 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->doInitializeHook() at /srv/www/htdocs/jar/drupal/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:36
 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->callInitializeHook() at /srv/www/htdocs/jar/drupal/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:29
 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->initialize() at /srv/www/htdocs/jar/drupal/vendor/consolidation/annotated-command/src/CommandProcessor.php:145
 Consolidation\AnnotatedCommand\CommandProcessor->initializeHook() at /srv/www/htdocs/jar/drupal/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:296
 Consolidation\AnnotatedCommand\AnnotatedCommand->initialize() at /srv/www/htdocs/jar/drupal/vendor/symfony/console/Command/Command.php:221
 Symfony\Component\Console\Command\Command->run() at /srv/www/htdocs/jar/drupal/vendor/symfony/console/Application.php:1018
 Symfony\Component\Console\Application->doRunCommand() at /srv/www/htdocs/jar/drupal/vendor/symfony/console/Application.php:271
 Symfony\Component\Console\Application->doRun() at /srv/www/htdocs/jar/drupal/vendor/symfony/console/Application.php:147
 Symfony\Component\Console\Application->run() at /srv/www/htdocs/jar/drupal/vendor/drush/drush/src/Runtime/Runtime.php:118
 Drush\Runtime\Runtime->doRun() at /srv/www/htdocs/jar/drupal/vendor/drush/drush/src/Runtime/Runtime.php:49
 Drush\Runtime\Runtime->run() at /srv/www/htdocs/jar/drupal/vendor/drush/drush/drush.php:72
 require() at /srv/www/htdocs/jar/drupal/vendor/drush/drush/drush:4

I looked at all the above suggestions, but am stuck. Drush works perfectly on my other 5 sites...

4
  • Have you tried with composer 1.x series? Nov 23, 2020 at 5:45
  • 2
    Yes I did, but I don't see how this can affect drush.
    – James Rome
    Nov 23, 2020 at 16:54
  • 1
    This is late but your issue was most likely a missing composer.json Apr 20, 2021 at 8:59
  • In my case, the composer install had only partially run so the drush files it was looking for did not exist. I deleted composer.lock and vendor and re-installed and it worked.
    – dmgig
    Mar 7 at 21:42

1 Answer 1

0

A missing composer.json file was the solution for me.

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.