I am getting the following error in a Drupal 8 site.
The following module is missing from the file system
It looks as if a custom module was installed and deleted without uninstalling it.
How can I fix this error?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI am getting the following error in a Drupal 8 site.
The following module is missing from the file system
It looks as if a custom module was installed and deleted without uninstalling it.
How can I fix this error?
If you have Drupal Console then a quick way to fix this is to generate a module with the same machine name, then uninstall it.
$ drupal generate:module
Then type the machine name at the appropriate prompt and accepts defaults for everything else.
$ drush pm-uninstall
Then you can delete the newly generated module from the file system and continue with your day.
(NB you may find need to keep that generated module, else the error will return. In that case, if you need to install a contrib module with the same name, remove the generated module after adding the contrib module. Then clear the cache.)
Assuming you have deleted an unimportant custom module which doesn't need any uninstall routine to be triggered, you can use the following Drush command.
Drupal 7
drush sql-query "DELETE from system where type = 'module' AND name = 'MYMODULE';"
Drupal 8
drush sql-query "DELETE FROM key_value WHERE collection='system.schema' AND name='MYMODULE';"
See How to fix "The following module is missing from the file system..." warning messages for more info and alternatives.
Now with the Configuration Management module the modules configuration is stored in the core.extension.yml file.
Go to edit the file and try to find the missing module from the filesystem then delete the line and import the config (drush cim
).
If this not works but you has found the module, then create the module again (just the folder and a valid .info.yml file) and run again the drush cim
command. This will uninstall the module.
The way I fixed it was by using drush and composer. Get the module with require, install and uninstall with drush then remove with composer.
composer require drupal/missing_module
drush en missing_module
drush pmu missing_module
composer remove drupal/missing_module
! The step with drush en
probably is not nessesary
if you know exactely what you're doing and can't use a cleaner method from https://www.drupal.org/docs/updating-drupal/troubleshooting-database-updates
here is a suggestion :
drush php:eval '\Drupal::configFactory()->getEditable("core.extension")->clear("module.MY_MODULE_THAT_BREAKS_THINGS")->save(TRUE);'
drush cr