Installing the module throws error

Created on 14 August 2024, 3 months ago

Problem/Motivation

Enabling the module on Drupal core 10.3 throws error while executing simple drushcommand

Steps to reproduce

  1. Install the module
  2. Type any drush command in the terminal
  3. Throws following:

    [error]  ArgumentCountError: Too few arguments to function Drupal\drush_clear_plugins_cache\Commands\PluginManagerCacheCommands::__construct(), 0 passed and exactly 1 expected in Drupal\drush_clear_plugins_cache\Commands\PluginManagerCacheCommands->__construct() (line 30 of /var/www/html/docroot/modules/contrib/drush_clear_plugins_cache/src/Commands/PluginManagerCacheCommands.php) #0 [internal function]: Drupal\drush_clear_plugins_cache\Commands\PluginManagerCacheCommands->__construct()
    #1 /var/www/html/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(193): ReflectionClass->newInstanceArgs(Array)
    #2 /var/www/html/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(174): Drush\Runtime\LegacyServiceInstantiator->instantiateObject('Drupal\\drush_cl...', Array)
    #3 /var/www/html/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(131): Drush\Runtime\LegacyServiceInstantiator->create('Drupal\\drush_cl...', Array, Array)
    #4 /var/www/html/vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(60): Drush\Runtime\LegacyServiceInstantiator->instantiateServices(Array)
    #5 /var/www/html/vendor/drush/drush/src/Boot/DrupalBoot8.php(239): Drush\Runtime\LegacyServiceInstantiator->loadServiceFiles(Array)
    #6 /var/www/html/vendor/drush/drush/src/Boot/DrupalBoot8.php(215): Drush\Boot\DrupalBoot8->addDrupalModuleDrushCommands(Object(Drush\Boot\BootstrapManager))
    #7 /var/www/html/vendor/drush/drush/src/Boot/BootstrapManager.php(236): Drush\Boot\DrupalBoot8->bootstrapDrupalFull(Object(Drush\Boot\BootstrapManager), NULL)
    #8 /var/www/html/vendor/drush/drush/src/Boot/BootstrapManager.php(422): Drush\Boot\BootstrapManager->doBootstrap(5, 6, NULL)
    #9 /var/www/html/vendor/drush/drush/src/Application.php(225): Drush\Boot\BootstrapManager->bootstrapMax()
    #10 /var/www/html/vendor/drush/drush/src/Application.php(191): Drush\Application->bootstrapAndFind('pmu')
    #11 /var/www/html/vendor/symfony/console/Application.php(266): Drush\Application->find('pmu')
    #12 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #13 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #14 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
    #15 /var/www/html/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
    #16 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
    #17 /var/www/html/vendor/bin/drush(119): include('/var/www/html/v...')
    #18 {main}. 
    

Proposed resolution

Remaining tasks

Issue fix.

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇮🇳India prashant.c Dharamshala

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @prashant.c
  • First commit to issue fork.
  • Merge request !1fixed drush issue → (Open) created by Unnamed author
  • Status changed to Needs review 3 months ago
  • 🇮🇳India sarwan_verma

    Hi,

    I have resolved the "module installation " issue and created MR!1.

    please review and verify it

    Thanks!

  • Status changed to RTBC 3 months ago
  • 🇮🇳India bhaveshdas

    Hi I have tested MR!1 in drupal 10 version.Its working properly right now.

    Attaching the Before and After screenshots.

    Hence it can be move to the RTBC.
    RTBC+1

    Thankyou !!

  • Status changed to Needs review 3 months ago
  • 🇮🇳India prashant.c Dharamshala

    @sarwan_verma @bhaveshdas

    You have just changed the key name which could be anything, I am not sure how it is fixing the issue. Could you please explain?

    The error is about the constructor in the drush command class, Drupal\drush_clear_plugins_cache\Commands\PluginManagerCacheCommands is expecting an argument.

    public function __construct(ContainerInterface $container) {
        parent::__construct();
        $this->container = $container;
      }

    and in the drush.services.ymlfile no argument is passed. We need to pass @service_containerargument, which should be the correct fix for this issue.

    I have pushed the change after testing locally, please review.

    Thanks

Production build 0.71.5 2024