Closed sananeyazi-voya closed 9 months ago
I just tested this, and following this guide seems to work:
- Execution. Change your working directory to your project root, and call Drush via vendor/bin/drush. To make this easier, append ./vendor/bin to the end of your $PATH; this allows you to call Drush via drush once your working directory is set. If you only have only one Drupal codebase on your system, you may put /path/to/vendor/bin/drush in your $PATH; if you do this, then it is not necessary to set your working directory before calling Drush.
From https://www.drush.org/latest/install/.
This works well in my ~/.profile
file, allowing me to use drush st
:
# add Drush, see https://www.drush.org/latest/install/
PATH="./vendor/bin:$PATH"
I also tried with /path/to/vendor/bin/drush
but that does not work ...
Like I wrote, I tried the "run Drush from any folder" option, which never worked for me before. I realized it is due to a wrong path in the documentation, so I have created the merge request #5826, which fixes this.
I made a fork which supports Drush 12 https://github.com/YahyaAhmad/drush-launcher Release https://github.com/YahyaAhmad/drush-launcher/releases/tag/0.10.3
Thanks! Feel free to share it in #5828, where this is dicussed.
PATH="./vendor/bin:$PATH"
This works but only in the root directory of the Drupal instance.
The following works in all sub directories.
function drush() {
local dir=$(pwd)
while [ "$dir" != "/" ]; do
if [ -x "$dir/vendor/bin/drush" ]; then
"$dir/vendor/bin/drush" "$@"
return
fi
dir=$(dirname "$dir")
done
echo "Drush executable not found."
}
Test it with drush status
Describe the bug
We have
Acquia/BLT
basedDrupal 10 (10.0)
site and usingDRUSH
as a dependency in our site. We have to update the latest blt library (acquia/blt 13.7.4) which requires drush version 12. But when we run drush commands with drush12, we are getting below messageSo we have to run drush with
vendor/bin/drush
instead of onlydrush
Found few issues which states drush-launcher does not support by drush12 https://github.com/Islandora-Devops/isle-buildkit/pull/286 https://github.com/Islandora-Devops/isle-buildkit/issues/283 https://github.com/drush-ops/drush-launcher/issues/106
Also tried suggesstions given in above links, but nothing works in our case.
Can anyone please suggest any alternatives of drush-launcher or solution to fix this problem? Your help would be much appreciated
To Reproduce Install drupal 10.0 Install drush 12( with drush launcher) php 8.1 Run any command suppose 'drush cr'
Expected behavior Drush command should run without adding
vendor/bin
System Configuration
| --------------- | --- | Drush version? | 12.4.3 | Drupal version? | 10.0.11 | PHP version | 8.1 | OS? | Linux