Drupal 8 Composer/Drush Errors Plugin Does Not Exist

PROBLEM
You done f**ked up. You did a $ composer uninstall on a module before you disabled it. You go in to import or do something else drush related. Boom! Errors!

I recently received the following errors when I accidentally did this with views_accordion:

The "views_accordion" plugin does not exist. Valid plugin IDs for Drupal\views\Plugin\ViewsPluginManager are: entity_reference_revisions, serializer, data_export, default, default_summary, entity_reference, grid, html_list, opml, rss, table, unformatted_summary
[warning] include_once(/appdata/www/web/modules/contrib/views_accordion/views_accordion.module): failed to open stream: No such file or directory Extension.php:147
[warning] include_once(): Failed opening '/appdata/www/web/modules/contrib/views_accordion/views_accordion.module' for inclusion (include_path='/appdata/www/vendor/pear/archive_tar:/appdata/www/ACF-D8-Enterprise/vendor/pear/console_getopt:/appdata/www/ACF-D8-Enterprise/vendor/pear/pear-core-minimal/src:/appdata/www/vendor/pear/pear_exception:.:/opt/rh/rh-php72/root/usr/share/pear:/opt/rh/rh-php72/root/usr/share/php') Extension.php:147

SOLUTION
You will need to re-install the missing module again, then do a cache refresh, then disable it, then uninstall it. Like the following:

$ composer require drupal/views_accordion
$ drush cr
$ drush pm:uninstall views_accordion
$ composer remove views_accordion
$ drush cr

The first $ drush cr refreshes the cache. This step is very important because it then determines the link to the “newer” views_accordion module. That was the key! Then you should be able to disable the module and uninstall it the correct way.

Need to remember this for later! Mistakes happen.

BONUS
Here’s a command I put in my “to remember” pile as well. If you get an error about The following module is missing from the file system... error, you can do the following:

$ drush sql-query "DELETE FROM key_value WHERE collection='system.schema' AND name='the_module_its_bitching_about';"

The the_module_its_bitching_about is the machine name of the module it’s bitching about.

Leave a Reply

Your email address will not be published. Required fields are marked *