drupal-console icon indicating copy to clipboard operation
drupal-console copied to clipboard

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

Open kenorb opened this issue 6 years ago • 11 comments

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:

  • I'm looking for the command to 'Download, install and serve a new Drupal project' in the simplest steps, equivalent to drush qd.

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

kenorb avatar Mar 25 '18 19:03 kenorb

+1

briantully avatar Mar 28 '18 14:03 briantully

+1

brahimmouhamou avatar Apr 11 '18 19:04 brahimmouhamou

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 avatar May 28 '19 20:05 johnbburg

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 avatar May 29 '19 00:05 hjuarez20

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

hjuarez20 avatar May 29 '19 00:05 hjuarez20

Same issue here - why is this closed?

jcicero518 avatar Sep 27 '19 22:09 jcicero518

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.

jcicero518 avatar Sep 27 '19 22:09 jcicero518

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.

enzolutions avatar Sep 28 '19 20:09 enzolutions

I have this issue too on:

  • Microsoft 10 home
  • Cmder version 180626
  • XAMPP Version 7.3.9

2019-10-01_151948

nequeteme avatar Oct 01 '19 20:10 nequeteme

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.

horvan avatar Sep 21 '21 14:09 horvan

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.

zoiosilva avatar Oct 08 '21 20:10 zoiosilva