Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ericmorand opened this issue Sep 7, 2020 · 24 comments

Comments

@ericmorand
Copy link

ericmorand commented Sep 7, 2020

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
@zefredz
Copy link

zefredz commented Oct 1, 2020

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

@mduvergey
Copy link

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

@nicoschi
Copy link

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
Copy link

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.

@bobemoe
Copy link

bobemoe commented Oct 28, 2020

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

@stef-van-looveren
Copy link
Contributor

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

Confirming. I'm on drupal 9.0.7

@ewuillai
Copy link

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).

@cobenash
Copy link

cobenash commented Dec 5, 2020

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

@bobemoe
Copy link

bobemoe commented Dec 5, 2020

@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?

@deranga
Copy link

deranga commented Dec 7, 2020

Same issue:

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

@lalop
Copy link
Contributor

lalop commented Dec 21, 2020

Same issue with drupal 8.9.11 and console 1.9.7

@OneiroDancer
Copy link

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

@emb03
Copy link

emb03 commented Apr 9, 2021

Issue still present Drupal 8.9.13 Console 1.9.7

@webmasterpf
Copy link

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.                     

@mandclu
Copy link

mandclu commented Jul 24, 2021

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.

@komlenic
Copy link

komlenic commented Nov 3, 2021

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

@mac-dev
Copy link

mac-dev commented Jan 5, 2022

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

@MrTimber
Copy link

MrTimber commented Jan 10, 2022

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)

@Farnoosh63
Copy link

Farnoosh63 commented Feb 7, 2022

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

@jfremer
Copy link

jfremer commented Feb 7, 2022

This issue is still present in 1.9.8.

@achraf-jeday
Copy link

achraf-jeday commented Mar 1, 2022

@lexsoft00
Copy link

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.`
"

@liquidcms
Copy link

Patch from Mar 1 does not apply to 1.9.8.

LOBsTerr added a commit to LOBsTerr/drupal-console that referenced this issue Sep 16, 2022
…st.module to avoid errors service is not found.
LOBsTerr added a commit that referenced this issue Sep 16, 2022
* Add new arguments key and target. Make it possible use not only default target for db connections

* Issue #4265: Replace DI with direct call of extension.list.module to avoid errors service is not found.
@LOBsTerr
Copy link
Member

Thank you all for contribution

LOBsTerr added a commit that referenced this issue Sep 17, 2022
LOBsTerr added a commit that referenced this issue Sep 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.