I updated a site with "Composer update --with-dependencies" and encountered the following problem:

User warning: The following module is missing from the file system: phpmailer in drupal_get_filename()

Then I ran: composer require drupal/phpmailer.

Terminal returned:

Using version ^3.0@beta for drupal/phpmailer
./composer.json has been updated


Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files

But the Status Report still showed that phpmailer module was missing.

So I attempted running "drush en phpmailer -y"

And it returned:

phpmailer was not found.                                             [warning]
The following projects provide some or all of the extensions not     [ok]
Would you like to download them? (y/n): y
This codebase is assembled with Composer instead of Drush. Use       [error]
`composer update` and `composer require` instead of `drush
pm-updatecode` and `drush pm-download`. You may override this error
by using the --pm-force option.
phpmailer was not found.                                             [warning]
Unable to download some or all of the extensions.                    [warning]
There were no extensions that could be enabled.                      [ok]

What can I do to fix this?

  • Is it actually there? Just because composer.lock lists it doesn't mean it's physically there
    – Clive
    Commented Jul 26, 2018 at 12:38
  • I just looked at the modules/phpmailer directory and saw that it indeed was empty.
    – Rusletov
    Commented Jul 26, 2018 at 12:52
  • That's your problem then - it's been removed but composer hasn't been told it's been removed, so it think it's still installed. Just download it manually and stick it in there, composer will start behaving again after that
    – Clive
    Commented Jul 26, 2018 at 12:53

1 Answer 1


There is a module for that: https://www.drupal.org/project/module_missing_message_fixer

And you can try drush or devel according to the doc here https://www.drupal.org/node/2487215

Use Drush

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

When done, clear the site's caches (e.g. drush cr). Also make sure that the CMI folder is cleansed of the broken uninstalled module. There may be some yml files left over and / or some system config. (this is all not the best way to do things as a FYI. However with Drupal 8 being so young, things don't go as planned always).

Use Devel

Enable Devel module and go to /devel/php. This will allow you to run some PHP code and you can execute the following:

$query = \Drupal::database()->delete('key_value')
    ->condition('collection', 'system.schema')
    ->condition('name', 'module_name')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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