hechoendrupal / drupal-console

The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.
http://drupalconsole.com
GNU General Public License v2.0
939 stars 559 forks source link

[quick:start] [ERROR] DrupalConsole must be executed within a Drupal Site. #3847

Open kenorb opened 6 years ago

kenorb commented 6 years ago

Problem/Motivation

As per quick-start.html, I expect that drupal quick:start will download, install and serve a new Drupal project.

Instead, I've got the error:

$ ./vendor/bin/drupal quick:start
[ERROR] DrupalConsole must be executed within a Drupal Site.

Same for drupal init:

$ ./vendor/bin/drupal init
[ERROR] DrupalConsole must be executed within a Drupal Site. 

I've installed DrupalConsole using composer require drupal/console.

Details to include:

How to reproduce

On empty folder:

  1. composer require drupal/console
  2. vendor/bin/drupal init
  3. vendor/bin/drupal quick:start

Details

drupal/console                        1.8.0
briantully commented 6 years ago

+1

brahimmouhamou commented 6 years ago

+1

johnbburg commented 5 years ago

Another +1

This appears to be a problem with the console launcher. I ran into this issue when using that, but if I call the console bin directly via the full path to it in vendor, I get the interaction to set up my console config:

$ /vagrant/vendor/drupal/console/bin/drupaldrupal init --root=/vagrant/web

hjuarez20 commented 5 years ago

Hi @kenorb When you install the console using composer in an empty folder, you can't use the global commands, because you are only downloading only the console and must run in a Drupal site.

For use the global commands without a Drupal site, you must install the launcher.

hjuarez20 commented 5 years ago

Another +1

This appears to be a problem with the console launcher. I ran into this issue when using that, but if I call the console bin directly via the full path to it in vendor, I get the interaction to set up my console config:

$ /vagrant/vendor/drupal/console/bin/drupaldrupal init --root=/vagrant/web

@johnbburg that seems another issue not related to this

jcicero518 commented 5 years ago

Same issue here - why is this closed?

jcicero518 commented 5 years ago

FYI, I wrote a dirty hack for the project I'm working on for anyone who needs it. I'm using vagrant w/Homestead box.

Find drupal.php (/vendor/drupal/console/bin/drupal.php)

~Line 49: $drupalFinder = new DrupalFinder(); if (!$drupalFinder->locateRoot($root)) { $io->error('DrupalConsole must be executed within a Drupal Site.'); exit(1); }

I overwrote $root with my own hard-coded path: $customRoot = '/home/vagrant/code/my-site-folder'; $root = $customRoot;

You can check if its working first, ->locateRoot() returns bool so: var_dump($drupalFinder->locateRoot($customRoot))

No time to fix this properly but I will if there's interest.

enzolutions commented 5 years ago

Thanks @jcicero518 we will try to review your suggestion and try to implement some of your logic for the next release 1.9.4 in October.

nequeteme commented 5 years ago

I have this issue too on:

2019-10-01_151948

horvan commented 3 years ago

another +1 Console is currently not usable to create a new project because of this behavior. Regardless wich OS is used. The screenshot above illustrates current behavior perfectly.

zoiosilva commented 3 years ago

I was having the same problem (not via quick:start, though), and in my case it was even ignoring the --root CLI parameter.

it's just that the root location was being grabbed from a config yaml file instead of the CLI:
image

Fixing the path in the config file completely solved the issue for me.