7

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
6
  • 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
    Commented Feb 26, 2018 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
    Commented Feb 26, 2018 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
    Commented Feb 26, 2018 at 19:16
  • I walked through the releases and things changed with Drush 9.0.0-rc2
    – Adrained
    Commented Feb 26, 2018 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
    Commented Feb 27, 2018 at 6:04

4 Answers 4

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

3
  • 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
    Commented Apr 9, 2018 at 19:26
  • Too bad. So the scaffolded files are present and you still get the error I guess? Commented Apr 9, 2018 at 19:39
  • yep, still not bootstrapping at all.
    – Adrained
    Commented Apr 9, 2018 at 20:08
6

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).

3
  • 1
    Thanks for putting in this @therobyouknow I've not seen this problem in ages, hopefully this might help someone in the future.
    – Adrained
    Commented Jul 25, 2019 at 1:24
  • +1 @Adrained you're welcome! Commented Jan 24, 2020 at 16:32
  • This worked for me. Think some of the permissions had changed for this directory and reinstalling corrected that Commented Nov 1, 2022 at 10:02
2

I had this issue when upgrading from drush 8 to drush 9.

Drush was failing to find the settings files on the server I deployed to.

When creating the artifact for deployment, I had previously stripped out unnecessary files, including __PROJECT_ROOT__/composer.json.

It turns out, when I made sure __PROJECT_ROOT__/composer.json was included on the server, drush 9 found the settings files, and the database connection.

1
  • Thanks for putting this solution in @mcaleaa, looks like there are multiple solutions. Hopefully it might help someone in the future.
    – Adrained
    Commented May 18, 2021 at 18:15
1

This can also happen when composer.json is in place, but the additional pieces that move drupal/core from vendor into the web root are not fully in place.

I ran into this when updating a library that was using the old drupal/drupal package to the now standard drupal/core-recommended.

Even after adding this to composer.json I was still seeing the bootstrap error.

    "installer-paths": {
      "web/core": [
        "type:drupal-core"
      ]
    },
    "drupal-scaffold": {
      "locations": {
        "web-root": "web/"
      }
    }

The key missing piece was to also add the package composer/installers so that Drupal core was moved after downloading:

...
"require": {
  ...
    "composer/installers": "^1.2",
    "drupal/core-composer-scaffold": "^9.1",
    "drupal/core-recommended": "^9.1",
  ...
1
  • Thanks for putting this solution in @jhedtrsom, looks like there are multiple solutions! Hopefully it might help someone in the future.
    – Adrained
    Commented May 18, 2021 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.