0

I had a Drupal 8 project installed from Drupal 8 sources what had been downloaded from Drupal 8 site. Recently I heard a good thought that it would be more comfortable to have the project originally installed via Composer. I did the migration and now the project has a structure likewise installed via Composer. That is, it has the "web" subdirectory with Drupal 8 files, the "vendor" directory isn't included in Drupal files and so on.

The site worked successfully after migration.

However, I ran into a problem. Namely, after migration, I couldn't use Drush on the project. The following error appeared upon trying to execute drush cr.

Command cache-rebuild needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command.
Command cache-rebuild requires Drupal core version 8+ to run.

My colleagues advised me to install Drush-launcher from GitHub as a shell for original Drush. I did it, this problem seemingly disappeared. But I ran into a next one. Namely, Now I can't use Drush for projects made on Drupal 7.

Is it possible to set up Drush for sites installed via Composer and without using the launcher?

12
  • Install Drush 8 globally, that'll cover your Drupal 7 projects, and install drush 9 locally to drupal 8 sites. The launcher will take care of the rest
    – Clive
    Jun 27, 2018 at 10:01
  • I have Drush 8 installed globally. And I have the "drush/drush" package version 9 in my Drupal 8 project. Is it not sufficient? How and where can I install Drush 9 locally ? Jun 27, 2018 at 10:23
  • If you have drush 8 why can't you use drush for projects made on drupal 7? drush 8 supports drupal 7. You shouldn't even need the launcher, drush is smart enough to work it out any time i've installed it
    – Clive
    Jun 27, 2018 at 10:30
  • If I use modified Drush (with drush launcher), upon working with Drupal 7 projects I see this error message. The Drush launcher could not find a Drupal site to operate on. Please do one of the following: - Navigate to any where within your Drupal project and try again. - Add --root=/path/to/drupal so Drush knows where your site is located. Otherwise, if I use original Drush 8, I can't work with Drupal 8 projects installed via Composer. I forgot to notify before that I use Windows 7 + Acquia Dev Desktop. Jun 27, 2018 at 10:35
  • Oh it's Windows? Windows is notoriously buggy with both PHP and Drush. If you can convert to a linux VM you'll probably find life a lot easier. I'm on a Mac and I've never run into the problems you're describing
    – Clive
    Jun 27, 2018 at 10:42

1 Answer 1

1

Acquia Dev Desktop comes with Drush included, and I assume that you could just continue to use that for Drupal 7. However, since you installed Drush Launcher and are using it as drush (drush.bat), you are shadowing it. Break the shadowing by renaming one of the two.

1
  • I use two different bat-files for executing two drush versions for work with these sites. Jun 28, 2018 at 14:15

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.