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?

  • Are you using the configuration management in the site? – Adrian Cid Almaguer Sep 12 '17 at 20:06
  • Yes I am using that – Kevin Sep 12 '17 at 20:09
  • Some advance with the problem? I want to know at the end how do you solve the problem, this can arrive me too in any project. – Adrian Cid Almaguer Sep 15 '17 at 16:34
  • In Drupal 8.7.3 I am getting "following module is missing from the file system: php in drupal_get_filename()" but when I try install the php module I get an error about it already existing in core. The error is preventing me from uninstalling anything. Yesterday I upgraded to 8.7.3 and today to 8.5.3 and cannot shake the error. Cache has been cleared each time and all modules that I know about have been restored. I see notes about Drush but how to install it on 8.7.3? – WilliamK Jun 6 '19 at 3:20

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.

  • 1
    I tried few times and this for D8 doesnt work at least for d8.7. I would recommend solution below with generating dummy module and then uinstalling. – Marko Blazekovic Jun 23 '19 at 8:22

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.)

  • 2
    This was the simplest option after the SQL query above wouldn't work. – Chris Charlton Oct 19 '18 at 17:36
  • It helped to resolve my error for module not found. – Akshay Sawant Dec 11 '19 at 14:36

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.

  • 4
    This works, but the correct way is to restore the module and uninstall it. If that module provides schemas, configuration or so, it will remain in the system and you will have to clean it up manually otherwise. – Berdir Sep 13 '17 at 6:19
  • 1
    @Berdir if you can't find the custom module, we can do another thing? – Adrian Cid Almaguer Sep 13 '17 at 13:01
  • Not really, then you need to do it manually as suggested above with drush cedit or import/export in the core.extension file. – Berdir Sep 13 '17 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.