2

I had Drush 9 working before it got upgraded to 9.1.0 and am a little bit at my wits end why Bootstrap is failing and why I get "Bootstrap failed" or "! [NOTE] Drupal root not found. Pass --root or a @siteAlias in order to see Drupal-specific commands."

  • My build directory is separate from my vendor directory. (shorthanded below to [build] and [composer])
  • There are a couple of debugged commands below, one trying to use an alias, and one just using the help command.
  • There are a couple extra alias paths (the last two) which are not valid and I can't figure out where they come from (they are not in my drush.yml anywhere), but my alias file is found... @default.dev does seem to work.
  • adding -r or -uri (or using that in place of the alias) does not make any difference... I still get the Bootstrap failed.

What has changed from earlier versions of Drush 9, or what am I doing incorrectly here? There was similar things with Drush 8 at some point, but none of the solutions that I saw in there worked, and I didn't see anything specific to Drush 9.

[794e@794elmp01 htdocs]$ drush @default.dev cr -d
 [preflight] Config paths: /../.drush/drush.yml,/var/..[composer]/vendor/drush/drush/drush.yml
 [preflight] Alias paths: /../.drush/sites,/var/..[build]/sites,/var/..[build]/drush/sites,/var/..[composer]/drush/sites
 [preflight] Commandfile search paths: /var/../vendor/drush/drush/src
 [bootstrap] Bootstrap to site [0.2 sec, 10.19 MB]
  [Exception]
  Bootstrap failed.
Exception trace:
 () at /var/..[composer]/vendor/drush/drush/src/Boot/BootstrapHook.php:31
 Drush\Boot\BootstrapHook->initialize() at /var/..[composer]/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:34
 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->callInitializeHook() at /var/..[composer]/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:27
 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->initialize() at /var/..[composer]/vendor/consolidation/annotated-command/src/CommandProcessor.php:117
 Consolidation\AnnotatedCommand\CommandProcessor->initializeHook() at /var/..[composer]/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:391
 Consolidation\AnnotatedCommand\AnnotatedCommand->initialize() at /var/..[composer]/vendor/symfony/console/Command/Command.php:229
 Symfony\Component\Console\Command\Command->run() at /var/..[composer]/vendor/symfony/console/Application.php:859
 Symfony\Component\Console\Application->doRunCommand() at /var/..[composer]/vendor/symfony/console/Application.php:206
 Symfony\Component\Console\Application->doRun() at /var/..[composer]/vendor/symfony/console/Application.php:125
 Symfony\Component\Console\Application->run() at /var/..[composer]/vendor/drush/drush/src/Runtime/Runtime.php:112
 Drush\Runtime\Runtime->doRun() at /var/..[composer]/vendor/drush/drush/src/Runtime/Runtime.php:41
 Drush\Runtime\Runtime->run() at /var/..[composer]/vendor/drush/drush/drush.php:64
 require() at /var/..[composer]/vendor/drush/drush/drush:4
drush list -d
 [preflight] Config paths: /home/../.drush/drush.yml,/var/..[composer]/vendor/drush/drush/drush.yml
 [preflight] Alias paths: /home/../.drush/sites,/var/..[build]/sites,/var/..[build]/drush/sites,/var/..[composer]/drush/sites
 [preflight] Commandfile search paths: /var/..[composer]/vendor/drush/drush/src
 [bootstrap] Bootstrap to max [0.22 sec, 10.14 MB]
 [debug] Trying to bootstrap as far as we can [0.22 sec, 10.15 MB]
Drush Commandline Tool 9.1.0
! [NOTE] Drupal root not found. Pass --root or a @siteAlias in order to see Drupal-specific commands.

Also, additional info: this is the site reference in the default.site.yml:

dev:
  root: /var/..[build]/htdocs
  uri: http://dev.our.internal.url.com

I verified that the root and URI were correct, and that the URI was accessible from the server (it is not a public URI).

EDIT: Adding Drush Status (per request)

 drush status -d
 [preflight] Config paths: /home/../.drush/drush.yml,/var/[composer]/vendor/drush/drush/drush.yml
 [preflight] Alias paths: /home/../.drush/sites,/var/[build]/sites,/var/[build]/sites,/var/[composer]/drush/sites
 [preflight] Commandfile search paths: /var/[composer[/vendor/drush/drush/src
 [bootstrap] Bootstrap to max [0.19 sec, 10.14 MB]
 [debug] Trying to bootstrap as far as we can [0.19 sec, 10.15 MB]
 PHP binary    : /usr/bin/php
 PHP config    : /etc/php.ini
 PHP OS        : Linux
 Drush script  : /var/[composer]/vendor/bin/drush
 Drush version : 9.1.0
 Drush temp    : /tmp
 Drush configs : /home/../.drush/drush.yml
                 /var/[composer]/vendor/drush/drush/drush.yml
  • So what does drush status give you? Have you tried running Drush from different directories - project root, site root and so on. Which OS? – hansfn Feb 26 '18 at 14:16
  • Added the drush status to the question... I get the same values in the build folder and in the composer folder, in the sites/default folder (and in other folders in my multi-site), and in the root of the sites folder Running on CentOS Linux – Adrained Feb 26 '18 at 18:25
  • So I just backed out to Drush 9.0.0-beta8 and things are working again. Although it's no longer finding the aliases for some reason. I can only refer to sites with --uri and -root (or if I am in the specific directory) – Adrained Feb 26 '18 at 19:16
  • I walked through the releases and things changed with Drush 9.0.0-rc2 – Adrained Feb 26 '18 at 19:50
  • Nice job on tracking down when the problem was introduced. I think you have to test the newly released 9.2.0 version too. If that also doesn't work, I think you have to reopen the Github issue you created. I wonder: Have you installed a site-local Drush as expected by Drush 9 - ref docs.drush.org/en/master/install It's hard to tell from your info. – hansfn Feb 27 '18 at 6:04
0

I stumbled (and fell) upon the same issue today.

Following your work (missing composer.json at drupal's docroot), I was able to get over this problem, by making sure scaffolding was in place (inside drupal-project's composer.json). i.e.:

    "post-install-cmd": [
        "@drupal-scaffold",
        "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
    ],
    "post-update-cmd": [
        "@drupal-scaffold",
        "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
    ]

This may be quite obvious but got drush 9.2.1 working fine for me.

Good luck

  • Sadly, this does not work my particular situation, so likely going back to drawing board. I will mark this as answered, in case people have a situation like yours. – Adrained Apr 9 '18 at 19:26
  • Too bad. So the scaffolded files are present and you still get the error I guess? – Stefanos Petrakis Apr 9 '18 at 19:39
  • yep, still not bootstrapping at all. – Adrained Apr 9 '18 at 20:08
0

I has this issue and found this to work:

rm -Rf vendor/drush
composer install

Credit: https://github.com/drush-ops/drush/issues/2959#issuecomment-332054773

This deletes drush and uses the composer.lock file to re-instate drush from the version specified there.

Version of drush is 9.5.2 on my setup (after running above command at time of writing).

  • Thanks for putting in this @therobyouknow I've not seen this problem in ages, hopefully this might help someone in the future. – Adrained Jul 25 at 1:24

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.