Skip to content
This repository has been archived by the owner on Aug 19, 2023. It is now read-only.

The Drush launcher could not find a Drupal site #45

Open
petiar opened this issue Feb 20, 2018 · 19 comments
Open

The Drush launcher could not find a Drupal site #45

petiar opened this issue Feb 20, 2018 · 19 comments

Comments

@petiar
Copy link

petiar commented Feb 20, 2018

drush --debug output

ROOT: /var/www/html/debates/web/my-website
The Drush launcher could not find a Drupal site to operate on. Please do *one* of the following:
  - Navigate to any where within your Drupal project and try again.
  - Add --root=/path/to/drupal so Drush knows where your site is located.

The path /var/www/html/debates/web/my-website contains Drupal 7 installation. What shall I do???

@victoriachan
Copy link

victoriachan commented Feb 23, 2018

I have this problem too. I'm using this in a drupalvm installation.

As a workaround, I'm now using drush global instead of drush launcher. But would be good to know why we're having this problem with drush launcher.

@victoriachan
Copy link

victoriachan commented Feb 23, 2018

This might provide some insight. It seems the problem is with using drush launcher on a non-Composer D7 project: #33 and webflo/drupal-finder#35 (this one seems to have the solution)

@heddn
Copy link

heddn commented Mar 5, 2018

#49 seems to have a fix too.

@shelane
Copy link

shelane commented Mar 20, 2018

I followed fix from above only to be met with a new error:

Fatal error: Uncaught Error: Call to undefined function drush_main() in phar:///usr/local/bin/drush/bin/drush.php:153
Stack trace:
#0 /usr/local/bin/drush(10): require()
#1 {main}
  thrown in phar:///usr/local/bin/drush/bin/drush.php on line 153

So it is clearly seeing that it's Drush 8, but that function is not available.

@dbjpanda
Copy link

dbjpanda commented Apr 3, 2018

Go to the Drupal's root directory, create a composer.json with below snippets and then execute composer install

composer.json

{
    "require": {
        "drush/drush": "8.*"
    },
    "extra": {
        "installer-paths": {
            "core": ["type:drupal-core"]
        }
    }
}

@crittermike
Copy link

@shelane Did you ever find a fix for that error?

@shelane
Copy link

shelane commented Apr 17, 2019

I am using Docksal now and I don't have Drush Launcher installed locally. Everything I call is now in my container and I haven't had an issue.

@isalmanhaider
Copy link

from the root directory run

composer require drush/drush

@RogerBailey
Copy link

This error also occurs when there is a syntax error in your composer.json.

I had manually edited composer.json to remove the last required package but neglected to delete the trailing comma of the item that was now the last item in the list. Once I removed the comma Drush started working again.

@alevani
Copy link

alevani commented Feb 12, 2020

I had the same problem using drush v.8.3.2, using an older version worked for me (I used v.8.0.5)

wget https://github.com/drush-ops/drush/releases/download/8.0.5/drush.phar

@lukewhitmore
Copy link

lukewhitmore commented Apr 6, 2020

Looks like the newer versions of DrupalVM specify the following in composer.json:

{
  "require": {
    "geerlingguy/drupal-vm": "4.*",
    "drush/drush": "^10.2"
  }
}

As we're still using Drupal 7 for the corporate site at this stage, we require an earlier version of Drush. This can be provided by changing the version requirements.

E.g.

  "require": {
    "geerlingguy/drupal-vm": "4.*",
    "drush/drush": "^8.0"
  }
}

Once updated, composer update and you should be good to go.

@leymannx
Copy link

For me it was an empty composer.json in the webroot that has been created when I accidentally required a package in there but quit before it finished. Removing the empty composer.json fixed it.

$ drush -y updb

In Process.php line 256:

  The command "/usr/local/bin/drush updatedb:status --no-entity-updates --uri=default --root=/Users/leymannx/Sites/foobar/web" failed.

  Exit Code: 1(General error)

  Working directory:

  Output:
  ================
  The Drush launcher could not find a local Drush in your Drupal site.
  Please add Drush with Composer to your project.
  Run 'cd "/Users/leymannx/Sites/foobar/web" && composer require drush/drush'

@SeeyaSia
Copy link

SeeyaSia commented Apr 26, 2021

I'm having the same problem and none of these fixes are helping.

../../../vendor/drush/drush/drush status works just fine.

drush status cannot find a drupal directory.

I have this working on my old computer, having a hard time on a new machine.
..."needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command."

@SteveLefevre-Moodys
Copy link

I was having the same problem after I set up a new drupal site on my local dev env. However drush launcher seemed to learn the location of the new drupal install after I ran drush self-update

@mbomb007
Copy link

mbomb007 commented Jul 5, 2022

../../../vendor/drush/drush/drush status works just fine.

You can use vendor/bin/drush instead of vendor/drush/drush/drush

And as the previous comment said, I had the issue after updating my site to Drush 11, but once I updated the Drush Launcher using self-update to 0.10.1 the error went away.

@alexhass
Copy link

I think I have the same issue and need drush to run utf8mb4 conversion.

I have a server that need to be able to use drush with old D7 and maybe later with newer Drupal versions in parallel. Previously I used https://github.com/webflo/drush-shim/releases/download/0.2.4/drush.phar and when I checked the https://github.com/webflo/drush-shim site for latest version I was redirect to drush-launcher. So I thought I need to use the one here as the old project is not reachable anymore and redirects.

How can we solve this issue for D7 now?

@alexhass
Copy link

hm... I downloaded https://github.com/drush-ops/drush/releases/download/8.4.11/drush.phar and placed it in /usr/local/bin. Based on https://www.drush.org/latest/install/ latest Drush supported is 8.x.

Why do we need drush-launcher project? I'm confused...

@mbomb007
Copy link

There's some earlier comments that might be related to your issue.

Read the README.md to understand the purpose of this project.

@kartagis
Copy link

I was getting the same error on D7 and #45 (comment) worked, thanks a lot.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests