0

This configuration is working properly on xampp local install (drush version)

Drupal version : 9.5.1 DB driver : mysql DB hostname : localhost DB port : 3306 Database : Connected Drupal bootstrap : Successful PHP binary : C:/xampp/php/php.exe PHP config : C:/xampp/php/php.ini PHP OS : WINNT PHP version : 7.4.27 Drush script : C:/xampp/htdocs/mysite/vendor/drush/drush/drush Drush version : 11.4.0

But on webserver, any drush command I type (for example cr) returns a "Command "cr" is not defined." Drush was installed via composer global require drush/drush (also exists as vendor/bin/drush in website root with same behavior)

drush list returns :

Available commands: help Display help for a command list List commands I think I have pretty much the same config on another webserver with no such problem. Any ideas on that ?

2
  • 1
    Global Drush installs are not supported.
    – mona lisa
    Jan 13, 2023 at 15:40
  • Drush only supports one install method. It requires that your Drupal site be built with Composer and Drush be listed as a dependency. drush.org/latest/install
    – leymannx
    Jan 13, 2023 at 21:09

1 Answer 1

2

Drush used to be installed globally, but that will no longer work. Instead, Drush LAUNCHER is installed globally. This creates a global drush command, however it does not contain the Drush code itself. The Drush code is instead added to each project on a per-project basis, managed using composer. When calling drush, Drush Launcher will take your current working directory, determine if it is a Drupal installation, and if it is, look for Drush in the vendor folder, and execute that on the current Drupal installation.

2
  • Thank you Jaypan. I actually did it this way (but as I got The issue described above, I tried to add Drush globally also with no luck. But yes, drush launcher is in usr/local/bin and drush itself in my project root vendor folder. All files seems ok). Not sure what to do
    – duck
    Jan 16, 2023 at 8:07
  • Please re-read. Drush is NOT installed globally, and Drush launcher is NOT installed per-project. That is backwards. Drush launcher is installed globally, and Drush is launched on a per-project basis.
    – Jaypan
    Jan 16, 2023 at 15:28

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.