drupal-console
drupal-console copied to clipboard
[site:install] console.site_install - You have requested a non-existent service "extension.list.module".
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
I have the same issue with drupal/core 8.9.6
How to reproduce
- Install Drupal 8 using composer
- Require drupal/console
- Set database settings in sites/default/settings.php
- 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
Same here, trying to install Drupal 9.0.7 using Drupal Console without success. Drupal Console version is 1.9.5
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.
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 executedrupal
to retreive the commands list.
Same here on Drupal 8.9.7. The PR #4277 patch is working great. Thanks :)
Same here on Drupal 8.9.7. The PR #4277 patch is working great. Thanks :)
Confirming. I'm on drupal 9.0.7
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).
Hi, I have the same issue. Drupal version 9.0.10 Drupal Console version: 1.9.7
@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?
Same issue:
Drupal 9.0.10 Drupal Console 1.9.7 PR #4277 addresses the issue for me.
Same issue with drupal 8.9.11 and console 1.9.7
Issue still present and #4277 still working on Drupal 8.9.13 and (unsurprisingly) console 1.9.7.
Issue still present Drupal 8.9.13 Console 1.9.7
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.
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.
Drupal 9.27 Drupal Console 1.9.7 Patch from #4277 applies cleanly and fixes this issue.
Never patched Drupal Console. Is it possible to patch it with composer?
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)
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
This issue is still present in 1.9.8.
The patch file:
https://patch-diff.githubusercontent.com/raw/hechoendrupal/drupal-console/pull/4277.patch
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.` "
Patch from Mar 1 does not apply to 1.9.8.
Thank you all for contribution