drupal-console
drupal-console copied to clipboard
[module:install] Call to undefined function Drupal\Console\Command\Shared\system_rebuild_module_data()
Problem/Motivation
When trying to install a new module using module:install command, the following error is thrown:
Error: Call to undefined function Drupal\Console\Command\Shared\system_rebuild_module_data() in /var/www/vendor/drupal/console/src/Command/Shared/ProjectDownloadTrait.php on line 178 #0 /var/www/vendor/drupal/console/src/Command/Shared/ProjectDownloadTrait.php(117): Drupal\Console\Command\Module\InstallCommand->calculateDependencies(Array) #1 /var/www/vendor/drupal/console/src/Command/Module/InstallCommand.php(222): Drupal\Console\Command\Module\InstallCommand->downloadModules(Array, false) #2 /var/www/vendor/symfony/console/Command/Command.php(255): Drupal\Console\Command\Module\InstallCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #3 /var/www/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #4 /var/www/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Drupal\Console\Command\Module\InstallCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #5 /var/www/vendor/drupal/console-core/src/Application.php(187): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #6 /var/www/vendor/drupal/console/src/Application.php(64): Drupal\Console\Core\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #7 /var/www/vendor/symfony/console/Application.php(149): Drupal\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #8 /var/www/vendor/drupal/console/bin/drupal.php(89): Symfony\Component\Console\Application->run() #9 /var/www/vendor/drupal/console/bin/drupal(4): require('/var/www/vendor...') #10 {main} Error: Call to undefined function Drupal\Console\Command\Shared\system_rebuild_module_data() in Drupal\Console\Command\Module\InstallCommand->calculateDependencies() (line 178 of /var/www/vendor/drupal/console/src/Command/Shared/ProjectDownloadTrait.php).
How to reproduce
- Install Drupal 9.1.2 using composer
- Install Drupal Console 1.9.7
- Require any module you like, (e.g. drupal/admin_toolbar)
- Install module via console command (drupal moi admin_toolbar)
- Error is thrown
Same error is thrown, when using module:uninstall for any module that is already installed.
Solution
This seems to be similar to #4265, but this error occurs with a different command and the PR mentioned (#4277) does not solve the error outlined above.
I am getting the same error when running drupal debug:module
.
The reason this fails is the function was deprecated and removed in Drupal 9. https://www.drupal.org/project/devel/issues/3100242
Drupal 9.27 Drupal Console 1.9.7 Same results as above.