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

[site:install] console.site_install - You have requested a non-existent service "extension.list.module".

Open ericmorand opened this issue 3 years ago • 22 comments

Problem/Motivation

When attepting to install a new site using site:install command, the following error is thrown:

console.site_install - You have requested a non-existent service "extension.list.module".

How to reproduce

  • Install Drupal 9 using composer.
  • Require drupal/console.
  • Create an empty database and put the database settings into sites/default/settings.php
  • Execute vendor/bin/drupal site:install

ericmorand avatar Sep 07 '20 19:09 ericmorand

I have the same issue with drupal/core 8.9.6

How to reproduce

  1. Install Drupal 8 using composer
  2. Require drupal/console
  3. Set database settings in sites/default/settings.php
  4. Execute vendor/bin/drupal site:install

Error message

console.site_install - You have requested a non-existent service "extension.list.module".

The command "site:install" does not exist.

Package version

  • drupal/core 8.9.6
  • drupal/console 1.9.5
  • drupal/console-core 1.9.6
  • drupal/console-en 1.9.5
  • drupal/console-extend-plugin 0.9.4

Notes :

  • It worked with drupal/core 8.9.2 and drupal/console 1.9.4
  • I have the same issue when downgrading to drupal/console 1.9.4, so maybe this issue is caused by a change in drupal/core itself

I hope this could help.

Best regards

zefredz avatar Oct 01 '20 07:10 zefredz

Same here, trying to install Drupal 9.0.7 using Drupal Console without success. Drupal Console version is 1.9.5

mduvergey avatar Oct 24 '20 19:10 mduvergey

It seems this issue was introduced in Drupal 9 support commit where the Drupal deprecated system_rebuild_module_data() function was replaced by $this->extensionList->reset()->getList() from the @extension.list.module service injected in src/Extension/Manager.php to fix the deprecation.

Since there the site:install command is still in Drupal Console code but it isn't listed if you execute drupal to retreive the commands list.

nicoschi avatar Oct 25 '20 11:10 nicoschi

It seems a problem related to the injection in fact deleting the @extension.list.module injection and so using \Drupal::service('extension.list.module')->reset()->getList() instead of $this->extensionList->reset()->getList() inside Manager::discoverExtensions in works again but with an error after the install which seems anyway done right

It seems this issue was introduced in Drupal 9 support commit where the Drupal deprecated system_rebuild_module_data() function was replaced by $this->extensionList->reset()->getList() from the @extension.list.module service injected in src/Extension/Manager.php to fix the deprecation.

Since there the site:install command is still in Drupal Console code but it isn't listed if you execute drupal to retreive the commands list.

nicoschi avatar Oct 25 '20 11:10 nicoschi

Same here on Drupal 8.9.7. The PR #4277 patch is working great. Thanks :)

bobemoe avatar Oct 28 '20 12:10 bobemoe

Same here on Drupal 8.9.7. The PR #4277 patch is working great. Thanks :)

Confirming. I'm on drupal 9.0.7

stef-van-looveren avatar Nov 10 '20 10:11 stef-van-looveren

Hi, I have the same issue, trying to use Drupal Console to install extension modules in a Drupal container. Drupal version : 9.0.7 Drupal Console version : 1.9.7

Error message when executing the following command : drupal module:install jsonapi

Error: Call to undefined function Drupal\Console\Command\Shared\system_rebuild_module_data() in Drupal\Console\Command\Module\InstallCommand->calculateDependencies() (line 178 of /opt/drupal/vendor/drupal/console/src/Command/Shared/ProjectDownloadTrait.php).

ewuillai avatar Nov 30 '20 17:11 ewuillai

Hi, I have the same issue. Drupal version 9.0.10 Drupal Console version: 1.9.7

cobenash avatar Dec 05 '20 04:12 cobenash

@ewuillai your command and error looks a bit different from the original reported here, thought the function in question may be similar. Did the patch #4277 fix the issue?

bobemoe avatar Dec 05 '20 09:12 bobemoe

Same issue:

Drupal 9.0.10 Drupal Console 1.9.7 PR #4277 addresses the issue for me.

deranga avatar Dec 07 '20 10:12 deranga

Same issue with drupal 8.9.11 and console 1.9.7

lalop avatar Dec 21 '20 10:12 lalop

Issue still present and #4277 still working on Drupal 8.9.13 and (unsurprisingly) console 1.9.7.

OneiroDancer avatar Apr 01 '21 14:04 OneiroDancer

Issue still present Drupal 8.9.13 Console 1.9.7

emb03 avatar Apr 09 '21 18:04 emb03

D 8.9.16 and Drupal Console (1.9.7) give:

 $ drupal debug:multisite
console.site_install - You have requested a non-existent service "extension.list.module".                                                                                                          
 [ERROR] Command "debug:multisite", is not a valid command name.                     

webmasterpf avatar Jul 08 '21 12:07 webmasterpf

Had the same error with Drupal 9.2.2 and Console 1.9.7, using drupal generate:module. Seems like Drupal Console is just broken until this issue is fixed.

mandclu avatar Jul 24 '21 10:07 mandclu

Drupal 9.27 Drupal Console 1.9.7 Patch from #4277 applies cleanly and fixes this issue.

komlenic avatar Nov 03 '21 20:11 komlenic

Never patched Drupal Console. Is it possible to patch it with composer?

mac-dev avatar Jan 05 '22 17:01 mac-dev

Never patched Drupal Console. Is it possible to patch it with composer?

Yes :

    "extra": {
        ...
        "patches": {
            "drupal/console": {
                "Fix 'non-existent service extension.list.module'": "[YOUR LOCAL PATH]/drupal-console_fix-4277.patch"
            }
        },
        ...
    }

But this patch works only with drupal console <= 1.9.7, so if you want to use it, you have also to fix the version of drupal console :

    "require": {
        ...
        "drupal/console": "<=1.9.7",
        ...
    }

EDIT : It seems (according to my tests, but need confirmation from other people), that the bug is fixed with drupal console >= 1.9.8, using a different way (this patch has not been merged in drupal console)

MrTimber avatar Jan 10 '22 09:01 MrTimber

This is the patch file:

diff --git a/src/Extension/Manager.php b/src/Extension/Manager.php
index 19e4d4a7..31af0f97 100644
--- a/src/Extension/Manager.php
+++ b/src/Extension/Manager.php
@@ -46,11 +46,6 @@ class Manager
      */
     private $extension = null;

-    /**
-     * @var Drupal\Core\Extension\ModuleExtensionList
-     */
-    private $extensionList;
-
     /**
      * @var ModuleHandlerInterface
      */
@@ -67,7 +62,6 @@ class Manager
      * @param Site   $site
      * @param Client $httpClient
      * @param string $appRoot
-     * @param ModuleExtensionList $extensionList
      * @param ModuleHandlerInterface $moduleHandler
      * @param ThemeHandler  $themeHandler
      */
@@ -75,14 +69,12 @@ class Manager
         Site $site,
         Client $httpClient,
         $appRoot,
-        ModuleExtensionList $extensionList,
         ModuleHandlerInterface $moduleHandler,
         ThemeHandler $themeHandler
     ) {
         $this->site = $site;
         $this->httpClient = $httpClient;
         $this->appRoot = $appRoot;
-        $this->extensionList = $extensionList;
         $this->moduleHandler = $moduleHandler;
         $this->themeHandler = $themeHandler;
         $this->initialize();
@@ -250,7 +242,8 @@ class Manager
     {
         if ($type === 'module') {
             $this->site->loadLegacyFile('/core/modules/system/system.module');
-            $this->extensionList->reset()->getList();
+            $extensionList = \Drupal::service('extension.list.module');
+            $extensionList->reset()->getList();
         }

         if ($type === 'theme') {
diff --git a/uninstall.services.yml b/uninstall.services.yml
index 0b6fb832..c6b809a3 100644
--- a/uninstall.services.yml
+++ b/uninstall.services.yml
@@ -4,7 +4,7 @@ services:
     arguments: ['@app.root', '@console.configuration_manager']
   console.extension_manager:
     class: Drupal\Console\Extension\Manager
-    arguments: ['@console.site', '@http_client', '@app.root', '@extension.list.module', '@module_handler', '@theme_handler']
+    arguments: ['@console.site', '@http_client', '@app.root', '@module_handler', '@theme_handler']
   # Commands
   console.server:
     class: Drupal\Console\Command\ServerCommand

Farnoosh63 avatar Feb 07 '22 21:02 Farnoosh63

This issue is still present in 1.9.8.

jfremer avatar Feb 07 '22 22:02 jfremer

The patch file:

https://patch-diff.githubusercontent.com/raw/hechoendrupal/drupal-console/pull/4277.patch

achraf-jeday avatar Mar 01 '22 13:03 achraf-jeday

This issue is still present " `console.site_install - You have requested a non-existent service "extension.list.module".

[ERROR] Command "gm", is not a valid command name.` "

lexsoft00 avatar Jun 15 '22 15:06 lexsoft00

Patch from Mar 1 does not apply to 1.9.8.

liquidcms avatar Aug 20 '22 20:08 liquidcms

Thank you all for contribution

LOBsTerr avatar Sep 16 '22 15:09 LOBsTerr