New to DrupalConsole and wasn't getting anywhere with installing it (hadn't used composer in a while although it was installed). Finally i think i got DC installed.
I already had a working D8 install and in that folder i ran
vendor/bin/drupal init (need the full path)
which seemed to do something.
Now, when i try to generate a new module from this:
vendor/bin/drupal vendor/bin/generate:module --module reserve --module-path "sites/all/modules/reserve"
i get the error:
[ERROR] Command "generate:module", is not a valid command name.
any way to tell if i have DC installed correctly?
@liquidcms is Drupal installed?
yes..
I already had a working D8 install and in that folder i ran
vendor/bin/drupal init (need the full path)
which seemed to do something.
i think the bottom line is that most "linux" style tools that are command line based and require numerous dependencies be met are extremely tricky to get working in Windows. I have set up drupalvm and will try getting DC working there.
Maybe this is also related to the following tasks:
@liquidcms Starting on RC releases DC must be installed per site.
You can still install the global executable now named Launcher to help you find the drupal installation and DC on that particular site.
Try drupal list instead to show the available commands.
I got this error for a very basic reason: drupal was not installed yet - the settings.php and the database did not exist yet. Obvious I know, but adding the comment anyway for any other newbies out there.
@liquidcms @michaellenahan you can execute a drupal list to see the available list of commands.
Closing this one. Feel free to re-open if still happening after updating to the latest version.
you can execute a drupal list to see the available list of commands.
Hi!
I executed this command. This function is not in the list. How to fix it?
Perhaps drupal console was installed via composer and is executed from another directory than the Drupal directory? In which directory do you call the drupal console command?
Thanks, understood.
Installed through the composer, the commands appeared
If you are inside Drupal directory and still see that problem, try to use comand with "--uri" eg. drupal generate-module --uri=your.domain
The option --uri=multisite.name mentioned by @henkRW is required when using a multisite installation.
Interesting. This wasn't so painful with drush. Is there a way to implement autodetection based on a multi-site directory?
Downloaded Drupal Console launcher 1.8.0, not showing all generate commands, except gsa.
Looks like the lastest launcher only contains drupal-console-cole, not drupal-console, why is that, why not just put everything into one executable and distribute, isn't this the recommended way?
@weynhamz have you tried the commands below?
Run composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader
Run composer update drupal/console --with-dependencies
then depending on where your drupal folder is you could run
../vendor/bin/drupal gm
[SOLVED] but for me was just slightly more complicated.
PREREQUISITES:
Running an Ubuntu machine 16.04 with a Drupal console installed automatically with a Drupal 8 project created via composer create-project \
drupal-composer/drupal-project:8.x-dev \ drupal8.dev \ --prefer-dist \ --no-progress \--no-interaction
Having the main composer.json in srv/www/drupal8/drupal-composer-project/composer.json and the public_html (here named "web") in srv/www/drupal8/drupal-composer-project/web we find the drupal console executable here: srv/www/drupal8/drupal-composer-project/vendor/drupal/console/bin/drupal
we run composer update drupal/console --with-dependencies and are ready to generate:module
STEPS TO REPRODUCE:
cd srv/www/drupal8/drupal-composer-project/
vendor/drupal/console/bin/drupal list
_Important:_ this dir is where we run composer require for any drupal module/dependency we want to install (works fine)
EXPECTED RESULT:
view "generate:module" in the list of cmds and be able to run vendor/drupal/console/bin/drupal module:generate
WHAT WE GOT INSTEAD
vendor/drupal/console/bin/drupal list gives clearly a few cmds showing the drupal console does not recognize drupal. We made sure drupal:core can be found inside srv/www/drupal8/drupal-composer-project/composer.json require section
we run vendor/drupal/console/bin/drupal init with apparently no avail
SOLUTION
cd srv/www/drupal8/drupal-composer-project/web (the public_html)
install the drupal console here too: composer require drupal/console:~1.0 \
--prefer-dist \
--optimize-autoloader
cd ..
vendor/drupal/console/bin/drupal module:generate
WORKS FINE NOW.
After installing the Drupal Console in the public_html (no matter if the composer.json is in ../public_html) we are now able to drupal module:generate from ../public_html (srv/www/drupal8/drupal-composer-project/)
it's weird, because at the end of the day it turns out you download the drupal console together with the drupal project but one can not recognize the other and the only solution is install another instance of the console.
I was't able to find where the drupal console map the public_html folder
I got this error when I'm running Lando instance and executing this outside lando ssh and the drupal console and drush can't work properly if they can not connect to the database.
You can try to execute this drupal site:status to make sure that you are able to connect the database. If you got the same error site:status is not a valid command name That's mean you have to check the MySQL connection between your command line and the database.
This is fixed as suggested here
https://github.com/hechoendrupal/drupal-console/issues/3815#issuecomment-370656209