drush-launcher icon indicating copy to clipboard operation
drush-launcher copied to clipboard

drush-laucher 0.10.2 not working with drupal 10.1 and drush 12.1

Open NgatiaFrankline opened this issue 2 years ago • 7 comments

When i run ./vendor/bin/drush works fine.With drush launcher i get Please add Drush with Composer to your project message. Here is my debug output:

@>drush --debug
Drush Launcher Version: 0.10.2
ROOT: /var/www/drupal
DRUSH VERSION: 
DRUPAL ROOT: /var/www/drupal/web
COMPOSER ROOT: /var/www/drupal
VENDOR ROOT: /var/www/drupal/vendor
The Drush launcher could not find a local Drush on your Drupal site.
Please add Drush with Composer to your project.
Run 'cd "/var/www/drupal" && composer require drush/drush'

When i run drush:

@>drush cr
The Drush launcher could not find a local Drush in your Drupal site.
Please add Drush with Composer to your project.
Run 'cd "/var/www/drupal" && composer require drush/drush'

My Drupal installation folder /var/www/drupal My installer path from the drupal-recommend project:

            "web/core": [
                "type:drupal-core"
            ],

However, when I downgrade to composer require drush/drush:11.5 works fine. My debug output:

@>drush --debug
Drush Launcher Version: 0.10.2
ROOT: /var/www/drupal
DRUSH VERSION: 11
DRUPAL ROOT: /var/www/drupal/web
COMPOSER ROOT: /var/www/drupal
VENDOR ROOT: /var/www/drupal/vendor
 [preflight] Config paths: /var/www/drupal/vendor/drush/drush/drush.yml
 [preflight] Alias paths: /var/www/drupal/web/drush/sites,/var/www/drupal/drush/sites
 [preflight] Commandfile search paths: /var/www/drupal/vendor/drush/drush/src
 [info] Starting bootstrap to max [0.19 sec, 3.05 MB]
 [debug] Trying to bootstrap as far as we can [0.19 sec, 3.05 MB]
....

Don't see any error in my console. I tried even the fallback option did not work.

NgatiaFrankline avatar Jul 02 '23 23:07 NgatiaFrankline

see #105 about this. seems drush 12 is not supported by drush launcher by now and maybe never will. drush encourages to not use drush launcher anymore. use vendor/bin/drush and maybe add vendor/bin to your PATH to use without path as with the launcher (for multiple environments you can maybe use direnv for that

stefan-korn avatar Jul 04 '23 13:07 stefan-korn

@stefan-korn How does one 'not use drush launcher'?

alxvallejo avatar Aug 17 '23 15:08 alxvallejo

you can use vendor/bin/drush from your project and maybe add that to your PATH to still be able to just use "drush" as command. the drush launcher is a helper that let you use "drush" for all of your projects without adding to PATH, but drush launcher is not supported for drush 12 aynmore.

stefan-korn avatar Aug 17 '23 15:08 stefan-korn

@stefan-korn Well what if you have two separate drupal projects each with their own drush? You'd have to manually change your PATH settings each time you want to switch projects? Where's the sense in that?

alxvallejo avatar Aug 17 '23 15:08 alxvallejo

I was not involved in deciding of drush 12 to not support drush launcher anymore, but as far as I understand there were valid (technical) reasons for that (see #105 for details)

Consider using direnv for multi project setup like described at https://github.com/drush-ops/drush-launcher#alternatives

Surely it maybe a bit annoying if you used drush launcher for long time to switch to something different, but that's the way it is I suppose. You can also check the drush issue queue, for example https://github.com/drush-ops/drush/issues/5694. There some alternatives have been discussed that may or may not work depending on your environment.

stefan-korn avatar Aug 17 '23 15:08 stefan-korn

FYI, its the other way around. Launcher is not supporting Drush12/Composer yet.

weitzman avatar Aug 17 '23 17:08 weitzman

@alxvallejo – Find some easy alias/function replacements for a global drush command in this issue: https://github.com/drush-ops/drush-launcher/issues/105

normanlolx avatar Aug 18 '23 08:08 normanlolx