drupal-console
drupal-console copied to clipboard
[quick:start] [ERROR] DrupalConsole must be executed within a Drupal Site.
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:
-
composer require drupal/console
-
vendor/bin/drupal init
-
vendor/bin/drupal quick:start
Details
drupal/console 1.8.0
+1
+1
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
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.
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
Same issue here - why is this closed?
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.
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.
I have this issue too on:
- Microsoft 10 home
- Cmder version 180626
- XAMPP Version 7.3.9
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.
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:
Fixing the path in the config file completely solved the issue for me.