Skip to content
This repository has been archived by the owner on Aug 19, 2023. It is now read-only.

drush launcher on Windows #63

Open
aon8 opened this issue Jul 11, 2018 · 5 comments
Open

drush launcher on Windows #63

aon8 opened this issue Jul 11, 2018 · 5 comments

Comments

@aon8
Copy link

aon8 commented Jul 11, 2018

Would you please give more details on how to install it locally on Windows! I am new to composer and drush. I installed drupal using the drupal-composer/drupal-project and drush was installed in the process but it still "is not recognized as an internal or external command,
operable program or batch file." . My search led me here but I'm now puzzled by how to install the launcher on Windows. Cheers

@webflo
Copy link
Collaborator

webflo commented Jul 12, 2018

The install instructions on https://github.com/drush-ops/drush-launcher/blob/master/README.md#installation---phar contain some information for Windows users (Step 4). Have you looked at these?

@aon8
Copy link
Author

aon8 commented Jul 12, 2018

Thanks for your reply @webflo. Sure I did look and that's why I said "more details" because I have no idea where to put the launcher folder and where to find the drush.phar. I couldn't find any file with .phar extension in any dir where drush is installed. Is it meant to be with the global composer drush folder ? I didn't install composer globally. Should I install a global one ? do I need a global drush anyways ?? I run laragon locally and composer is installed in the laragon\www dir . Yesterday, I installed drupal 8.5.5 using the drupal-composer/drupal-project option and drush was installed with all its dependencies (I understand) in laragon\www\myD8site where the drupal-project is. The drupal core is in laragon\www\myD8site\web and I later installed drush in this web dir too. Drush was not recognised by composer in either www or myD8site or \web dirs and always have the error "

'drush' is not recognized as an internal or external command,
operable program or batch file."

Drush version is 9.3 and I could only make it work when I ran it from the bin dir : laragon\www\myD8site\web\vendor\bin drush and here where comes the launcher job but I still couldn't see clear instructions on how to use it and where.

Edit: Running drush from the drupal-project root laragon\www\myD8site\vendor\bin drush didn't work and returned that error!

Running it from the laragon\www\vendor\bin worked but gave me this at the end:

! [NOTE] Drupal root not found. Pass --root or a @siteAlias in order to see Drupal-specific commands.

@aon8
Copy link
Author

aon8 commented Jul 12, 2018

Seems fixed.
I uninstalled drush from www
I downloaded drush.phar (I'd downloaded the zip file before)
I put drush.phar in C:\Users\Me\AppData\Roaming\Composer\vendor\bin
I renamed it to drush
I created in the above bin folder the drush.bat file with these lines (I changed drush.phar to drush) :

@echo off
php "%~dp0\drush" %*

I tested it and it works when I'm in the drupal core dir web
Whereas if I'm in the project myD8site it gives me this error

L:\laragon\www\myD8site\web/vendor/drush/drush/drush' is not recognized as an internal or external command, operable program or batch file.

I recall the drush that was installed by drupal-composer was in the drupal-project myD8site while I did the install in the drupal core dir web . Which one should I keep if no need for both :-?

@vijayxtreme
Copy link

Thanks a bunch. I just @aon8's messages, and basically seems like to get this working:

  1. Download drush.phar using command prompt (helps if you have Git Bash or equivalent for Windows)
  2. Create the drush.bat file (as per the directions from this Git)
  3. Place the bat file and drush.phar file in the Composer directory, which should be at:
    C:\Users\<username>\AppData\Roaming\Composer\vendor\bin
  4. Restart command prompt
  5. Navigate to your directory and you should be able to run drush commands, like drush cr

@gogowitsch
Copy link

gogowitsch commented May 18, 2019

Thanks for the helpful pointers above, though I couldn't get Drush to launch with @vijayxtreme steps.

Note to future self and other Googlers: When running from Git Bash, I had to run

export DRUSH_LAUNCHER_FALLBACK='sh C:\xampp\htdocs\drupal-7.61\vendor\drush\drush\drush.launcher'

All following calls to drush.phar were then successful.

Versions:

  • Launcher 0.6.0
  • Drush 8.0.5
  • Drupal 7.61

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants