I have a new install of Drupal 9.1.8, with drush 10.5 installed through composer inside a Vagrant VM.

But drush list gives:

Available commands:
  help  Displays help for a command
  list  Lists commands

And nothing else.

The commandfile search path is the default:


Where are my drush commands?

Things I've checked:

  • Yes, drush/drush has installed everything - I want the site:install command and it exists in the files.
  • I've checked the commandfile search path and it points to the right place.
  • The file permissions are 777, and that's fixed inside the VM.

Manually running ../vendor/bin/drush si --debug inside the VM gives the following:

vagrant@vagrant:/var/www/web$ ../vendor/bin/drush si --debug
 [preflight] Config paths: /var/www/vendor/drush/drush/drush.yml,/var/www/drush/drush.yml
 [preflight] Alias paths: /var/www/web/drush/sites,/var/www/drush/sites
 [preflight] Commandfile search paths: /var/www/vendor/drush/drush/src,/var/www/drush
 [debug] Bootstrap further to find site:install [0.11 sec, 6.89 MB]
 [debug] Trying to bootstrap as far as we can [0.11 sec, 6.9 MB]
 [debug] Drush bootstrap phase: bootstrapDrupalRoot() [0.11 sec, 6.9 MB]
 [debug] Change working directory to /var/www/web [0.11 sec, 6.9 MB]
 [debug] Initialized Drupal 9.1.8 root directory at /var/www/web [0.11 sec, 6.9 MB]
 [debug] Drush bootstrap phase: bootstrapDrupalSite() [0.12 sec, 7.22 MB]
 [debug] Initialized Drupal site default at sites/default [0.12 sec, 7.45 MB]
 [debug] Drush bootstrap phase: bootstrapDrupalConfiguration() [0.12 sec, 7.45 MB]
 [debug] Add service modifier [0.13 sec, 7.64 MB]
 [debug] key_value table not found. Database may be empty. [0.14 sec, 8.14 MB]
 [debug] Bootstrap phase bootstrapDrupalDatabase() failed to validate; continuing at bootstrapDrupalConfiguration() [0.14 sec, 8.14 MB]
 [debug] Done with bootstrap max in Application::bootstrapAndFind(): trying to find site:install again. [0.14 sec, 8.14 MB]

In Application.php line 243:
  Command site:install was not found. Drush was unable to query the database. As a result, many commands are  
   unavailable. Re-run your command with --debug to see relevant log messages.                                

Exception trace:
  at /var/www/vendor/drush/drush/src/Application.php:243
 Drush\Application->bootstrapAndFind() at /var/www/vendor/drush/drush/src/Application.php:196
 Drush\Application->find() at /var/www/vendor/symfony/console/Application.php:237
 Symfony\Component\Console\Application->doRun() at /var/www/vendor/symfony/console/Application.php:149
 Symfony\Component\Console\Application->run() at /var/www/vendor/drush/drush/src/Runtime/Runtime.php:118
 Drush\Runtime\Runtime->doRun() at /var/www/vendor/drush/drush/src/Runtime/Runtime.php:48
 Drush\Runtime\Runtime->run() at /var/www/vendor/drush/drush/drush.php:72
 require() at /var/www/vendor/drush/drush/drush:4

The message "Drush was unable to query the database" seems irrelevant because to do site:install (at least initially) does not require the database at all. It only tries because it can't find the command in the first place. But the credentials are all set up in settings.php anyway.

  • I don't think site:install is interactive. Create a settings file with database credentials or provide the credentials as options with the site:install command. Does the error persist? Are you actually able to install the site from the UI (just to see if it works)?
    – leymannx
    May 20 '21 at 16:17
  • It's not to do with interactivity, the command doesn't even start because drush can't find the command (it can't find any commands). "drush list" gives only two commands available: "help" and "list" (which are built-in to drush itself). I'm asking if anyone has any idea why that's happening, since everything is loaded. May 21 '21 at 20:11
  • I think I once had something similar and it was caused by something odd in the Drupal files and folder structure. Like missing sites/default/ directory in a multi-site setup or composer.json in an odd place, or accidentally run composer install inside the webroot or something like that. Can you check if there is anything odd in your file and folder structure? Also maybe try to call Drush directest as in vendor/drush/drush/drush si. Check for leftover symlinks or something like that. And if all doesn't work maybe provide the steps to reproduce your exact setup so we can check.
    – leymannx
    May 22 '21 at 8:01

Your Answer

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

Browse other questions tagged or ask your own question.