drush-launcher
drush-launcher copied to clipboard
The Drush launcher could not find a Drupal site
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???
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.
This might provide some insight. It seems the problem is with using drush launcher on a non-Composer D7 project: https://github.com/drush-ops/drush-launcher/issues/33 and https://github.com/webflo/drupal-finder/issues/35 (this one seems to have the solution)
#49 seems to have a fix too.
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.
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"]
}
}
}
@shelane Did you ever find a fix for that error?
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.
from the root directory run
composer require drush/drush
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.
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
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.
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'
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."
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
../../../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.
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?
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...
There's some earlier comments that might be related to your issue.
Read the README.md to understand the purpose of this project.
I was getting the same error on D7 and https://github.com/drush-ops/drush-launcher/issues/45#issuecomment-378414568 worked, thanks a lot.