Problem/Motivation
After running composer update including an update of Search API to 8.x-1.36, Drush stops working and gives the error message:
PHP Fatal error: Trait "Drush\Commands\AutowireTrait" not found in /var/www/web/modules/contrib/search_api/src/Drush/Commands/SearchApiDrushCommands.php on line 23
[warning] Drush command terminated abnormally.
This is due to running a Drush version < 12.5 on my instance (having Drush 12.4.3). Same issue was already reported to the Drush development team for the Devel-module, see https://github.com/drush-ops/drush/issues/5941
Proposed resolution
The resolution is described in the same issue in this comments: https://github.com/drush-ops/drush/issues/5941#issuecomment-2025263217 https://github.com/drush-ops/drush/issues/5941#issuecomment-2025352930 - the Devel resolution is to set "drush/drush": "<12.5.1" as conflict in composer.json. Could this also be a solution for search_api?
As a workaround run composer require 'drush/drush:^12.5' for your instance. Then the error disappears.
Issue fork search_api-3489598
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
kil commentedComment #3
kil commentedComment #6
drunken monkeyThanks for the suggestion, seems sensible!
We don’t really need that trait so would also have been quite easy to make do without it for now, but I guess requiring a relatively new Drush version doesn’t do much harm, either. So, I went with that and created an MR. Please test/review!
Comment #7
drunken monkeyI changed my mind, let’s keep compatibility and get rid of the
AutowireTrait.Changed the MR, please test!
Comment #9
drunken monkeyMerged.
Thanks again!