I moved from using Docksal to Acquia ADS (Lando) which automatically upgraded my Drush from 8 to 9. My local site works fine but I can't get Drush 9 to "see" my Drupal 8 site. The aliases seem to have been created and added to the drush/sites folder and running drush site:alias does show them. However running drush status shows my Drupal root as /app. My Drupal root is /app/docroot. My alias files do have this as their root (for local). I'm not sure why Drush doesn't use the alias files it knows about. I've tried:
drush @self(or @local) list and I get some commands and this statement at the end:
[NOTE] Drupal root not found. Pass --root or a @siteAlias in order to see Drupal-specific commands.
Doing drush @local(or @self) cr returns:
In BootstrapHook.php line 32: Bootstrap failed. Run your command with -vvv for more information.
With -vvv:
Exception trace: at /app/vendor/drush/drush/src/Boot/BootstrapHook.php:32 Drush\Boot\BootstrapHook->initialize() at /app/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:34 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->callInitializeHook() at /app/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:27 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->initialize() at /app/vendor/consolidation/annotated-command/src/CommandProcessor.php:145 Consolidation\AnnotatedCommand\CommandProcessor->initializeHook() at /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:289 Consolidation\AnnotatedCommand\AnnotatedCommand->initialize() at /app/vendor/symfony/console/Command/Command.php:221 Symfony\Component\Console\Command\Command->run() at /app/vendor/symfony/console/Application.php:1005 Symfony\Component\Console\Application->doRunCommand() at /app/vendor/symfony/console/Application.php:255 Symfony\Component\Console\Application->doRun() at /app/vendor/symfony/console/Application.php:148 Symfony\Component\Console\Application->run() at /app/vendor/drush/drush/src/Runtime/Runtime.php:118 Drush\Runtime\Runtime->doRun() at /app/vendor/drush/drush/src/Runtime/Runtime.php:49 Drush\Runtime\Runtime->run() at /app/vendor/drush/drush/drush.php:72 require() at /app/vendor/drush/drush/drush:4
drush status:
PHP binary : /usr/local/bin/php
PHP config :
PHP OS : Linux
Drush script : /app/vendor/drush/drush/drush
Drush version : 10.2.2 <-- Had 9.0.0 but currently trying 10, same issue
Drush temp : /tmp
Drush configs : /root/.drush/drush.yml
/app/vendor/drush/drush/drush.yml
/app/drush/drush.yml
Drupal root : /app
self.site.yml:
local:
root: /app/docroot
uri: example.lndo.site
Can someone please point me in the right direction?
Figured it out. No matter how many ways you try to tell Drush where to look to find your Drupal root, none of it will matter until you edit your composer.json file. Turns out the key to making Drush 9+ work is changing the name in composer. My composer.json file name went from: "name": "drupal/drupal", to: "name": "drupal-composer/drupal-project",
I don't think this feature was documented anywhere so I'm posting it here in response to my own question in case this helps anyone else.