Score:0

Untangle Composer Drush and non-Composer Drush

mx flag

I have Drush 10.3.2-dev working on my system but I also need to work on an old project in Drupal 7, so I need Drush 7 to work on that particular project.

I downloaded Drush 7, unpacked it in a folder, drush script is executable, but when I try to use it with ./drush I get

Unable to load autoload.php. Drush now requires Composer in order to install its dependencies and autoload classes. Please see README.md

How can I use old Drush that is compatible with Drupal 7 in parallel with the newer version?

Edited to add:

I uninstalled drush with Composer globally, and when I try to execute the downloaded script it is reporting the old (8) version of drush, but when I change to the my Drupal project directory and execute the same script it gives me another drush version.

There is some clash of drush versions on my system and I don't know where it's coming from.

~/Downloads$ ./drush.phar --version
 Drush Version   :  8.4.10 
/var/www/html/drupal$ ~/Downloads/drush.phar --version
Drush Commandline Tool 10.6.0

from another project I'm seeing yet another drush version:

/var/www/html/anotherProject$ ~/Downloads/drush.phar --version
Drush Commandline Tool 9.7.3

Do I need to uninstall Composerto make this work?


Another edit:

I think I might have found the issue, I have a /var/www/html/vendor folder that shouldn't be there (because I have all projects in subfolders). When I rename that folder drush works properly, recognizes particular projects db info.

leymannx avatar
ne flag
Does this answer your question? [Having multiple Drush instances for different core versions](https://drupal.stackexchange.com/questions/267511/having-multiple-drush-instances-for-different-core-versions)
leymannx avatar
ne flag
(You could if course also Composerize the D7 project and add Drush 8 as local dependency to it. Drupal 7 works with latest Drush 8 IIRC.)
mx flag
Thank you for the suggestions! I'm not bothered by making this permanent, so I don't mind to have to call drush directly from a specific folder, I just want the drush to work. Currently it's not, and I don't know what I'm missing. How do I check if I have Drush Launcher installed? I checked the bin folders and it's not there. Could the Launcher be causing troubles why I can't call the drush 7 script directly? How bothersome is composersizing D7? I only want drush to make one site update.
leymannx avatar
ne flag
The error message you state sounds odd. How exactly did you download Drush 7(?) from where. The error doesn't sound like Drush 7. Try the install method from the duplicate question to install the latest Drush 8.
mx flag
I think the error message might be from global Drush. I don't remember installing it globally, but I don't remember now. I dl D7 script from the repo, I don't think there's anything wrong with it, but probably something on my system is preventing it from running it.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.