1

We have 3 devs working on a Drupal 7 site. Drush 8 is provided via a local composer file drush/drush:~8.0. A drush.wrapper exists in the project root containing:

cd "`dirname $0`"
DRUSH_ALIAS_FILE="./drush/MYPROJECT.aliases.drushrc.php"
DRUSH_LAUNCHER="./vendor/bin/drush.launcher"

if [ ! -f $DRUSH_ALIAS_FILE ]; then
  echo "No Drush alias file was found at ./drush/MYPROJECT.aliases.drushrc.php"
  exit;
fi

if [ ! -f $DRUSH_LAUNCHER ]; then
  echo "Drush Launcher was not found at ./vendor/bin/drush.launcher. Have you ran 'composer install' from the project root?"
  exit;
fi

$DRUSH_LAUNCHER --local --alias-path=./drush "$@"

This works for everyone; except the one user on Windows. They get an error along the lines of "drush.php was not found". If he removes the file, drush works (but then it is using the globally installed drush). This of course would break it for everyone else.

I am confused by the docs. How does one properly supply Drush 8 with a Drupal 7 project via Composer and have 'drush' work as a command from the project? I see issues saying the wrapper file is not needed anymore and other posts saying you need one.

edit: We started over and installed drush launcher per the documentation with the Windows .bat file. It still gives the error:

"Could not open input file /usr/local/bin/drush"

  • If you have Windows 10 Pro, use Lando for your dev environment and you will never have to deal with these headaches. – No Sssweat Aug 22 '18 at 6:57
1

No, don't use drush.wrapper. There is a new tool in town - Drush Launcher. It works on Windows too since it's PHP based - just follow step 4 in the installation instructions. (Step 2 and 3 aren't relevant on Windows, and step 1 is just a normal file download on Windows.)

Added: You should remove/rename the global Drush if you have any. If you need it, check out the fallback option for Drush Launcher.

PS! Also the Linux/Mac people should use Drush Launcher.

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.