I have this problem when I run command drupal generate:module. I don't know why, despite everything I did was suggested on the documentation for Drupal Console.

I don't see all the possible commands, when I run drupal list.

Available commands:
  about                      Displays basic information about Drupal Console project
  chain                      Chain command execution
  check                      System requirement checker
  exec                       Execute an external command.
  help                       Displays help for a command
  init                       Copy configuration files.
  list                       Lists all available commands
  debug:chain (dch)          List available chain files.
  debug:settings (dse)       List user Drupal Console settings.
  debug:site (dsi)           List all known local and remote sites.
  develop:contribute         Download Drupal + Drupal Console to contribute.
  generate:site:alias (gsa)  Generates a site alias.
  quick:start                Download, install and serve a new Drupal project
  settings:set               Change a specific setting value in DrupalConsole config file
  site:new                   Download a new Drupal project
  • 5
    Console can't connect to your Drupal site. You probably don't have database credentials set up correctly, or you're running the command outside of the site root
    – Clive
    Jan 22, 2020 at 10:16
  • 1
    yeah probably , because when i run this command again "drupal list" it shows me the possible command above , and also this error ' [ERROR] The specified database connection is not defined: default ' , i am using docker and a mysql image , can docker causes this problem? Jan 22, 2020 at 10:20
  • 2
    Sounds likely yeah
    – Clive
    Jan 22, 2020 at 10:30
  • 1
    Probably drupal8-app_web_1
    – Clive
    Jan 22, 2020 at 12:39
  • 1
    It would be best if you get into the container and there run the command instead of shove it directly through the stdin. Something like docker exec -it drupal8-app_web_1 bash and them got to your Drupal root and vendor/bin/drupal generate:module. Not related but should make your dockerized Drupal life easier github.com/wodby/docker4drupal
    – d70rr3s
    Jan 22, 2020 at 18:13

2 Answers 2


I have faced the same problem this works 100 % :

  1. open the shell and cd to projectFolder
  2. run this command :
   composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader
  1. then run this command :
   composer update drupal/console --with-dependencies
  1. run drupal list command again, and you'll find the list of all commands.

    ! this steps must be repeated with each project.

  • it generate some list but not all of them , and throws this error " [ERROR] The specified database connection is not defined: default " , and i am using docker ,so i should get into web container ? , also when i run this command " docker exec -it drupal8-app_web_1 drupal generate:module" it shows me this error " [ERROR] Class Drupal\Core\DrupalKernel does not exist." Jan 23, 2020 at 10:37
  • when i run compose require ............ it gives me this =====> Nothing to install or update Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead................ Jan 23, 2020 at 11:26
  • Try --with-all-dependencies instead of --with-dependencies.
    – colan
    Jun 9, 2020 at 21:04

I had the same problem, it was resolved when I deleted extra blank composer.json file present inside "web" directory. Not sure how it got created but the issue got resolved when I deleted non-required composer.json

Folder Structure with Issue /path/to/site/dev

config/ vendor/ web/ composer.json composer.lock web/composer.json

Proposed fix /path/to/site/dev

config/ web/ vendor/ composer.json composer.lock

I got answer from below link, reposting if it helps someone


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.