In summary: I cannot uninstall pdf_reader sucessfully without bringing down my site with this error:
Drupal\Core\Extension\InfoParserException: The 'core' or the 'core_version_requirement' key must be present in modules/contrib/pdf_reader/pdf_reader.info.yml in Drupal\Core\Extension\InfoParserDynamic->parse() (line 73 of core/lib/Drupal/Core/Extension/InfoParserDynamic.php).
( I did search the above error but cannot see anything related).
Have a Drupal 8.9.8 dev site using Composer 1.10.7 (I did try and update to composer 2 but that caused a lot of other errors, which I wanted to save for another day!)
I had pdf_reader installed and wanted to uninstall it.
Used composer to uninstall it:
drush pmu pdf_reader
This completes to success.
I then rebuild the cache with:
drush cache-rebuild
However I noticed in composer.json, there is still an entry:
"drupal/pdf_reader": "1.x-dev",
if I login to drupal and check the installed modules pages I can see it and it's unticked.
At this point if I try and reinstall it using the UI I get the message: PDF Reader is already installed.
If I look in the following directory, I can see the pdf_reader folder still exists /web/modules/contrib/
If I now delete the above folder and clear the cache, it stops the website running with:
The website encountered an unexpected error. Please try again later.
Drupal\Core\Extension\InfoParserException: The 'core' or the 'core_version_requirement' key must be present in modules/contrib/pdf_reader/pdf_reader.info.yml in Drupal\Core\Extension\InfoParserDynamic->parse() (line 73 of core/lib/Drupal/Core/Extension/InfoParserDynamic.php).
At this point if I run:
drush cache-rebuild
I get a similar error:
In ExtensionDiscovery.php line 446:
SplFileInfo::openFile(/var/www/html/web/modules/contrib/pdf_reader/pdf_read
er.info.yml): failed to open stream: No such file or directory
(if I restore the pdf_reader folder and clear the cache the sites come back online).
So it seems like something is out of synch and/or not updating, any help appreciated (I'm far from a drupal expert, so I'm sure it's something simple for an expert))
My Composer.json file:
{
"name": "drupal/recommended-project",
"description": "Project template for Drupal 8 projects with a relocated document root",
"type": "project",
"license": "GPL-2.0-or-later",
"homepage": "https://www.drupal.org/project/drupal",
"support": {
"docs": "https://www.drupal.org/docs/user_guide/en/index.html",
"chat": "https://www.drupal.org/node/314178"
},
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"require": {
"composer/installers": "^1.2",
"drupal/admin_toolbar": "^2.3",
"drupal/astrology": "^1.4",
"drupal/bootstrap_barrio": "^5.1",
"drupal/coffee": "^1.0",
"drupal/copyright_footer": "^1.7",
"drupal/core-composer-scaffold": "^8.8",
"drupal/core-project-message": "^8.8",
"drupal/core-recommended": "^8.8",
"drupal/devel": "^4.0",
"drupal/entity_delete": "^1.6",
"drupal/fb_likebox": "^2.1",
"drupal/feeds": "^3.0@alpha",
"drupal/feeds_tamper": "^2.0@beta",
"drupal/flexslider_fields": "^2.0",
"drupal/fontawesome": "^2.17",
"drupal/gdoc_field": "^1.1",
"drupal/migrate_plus": "^5.1",
"drupal/migrate_tools": "^5.0",
"drupal/migrate_upgrade": "^3.2",
"drupal/paragraphs": "^1.12",
"drupal/pathauto": "^1.8",
"drupal/pdf": "^1.0",
"drupal/pdf_reader": "1.x-dev",
"drupal/superfish": "^1.4",
"drupal/tablefield": "^2.1",
"drush/drush": "^10.3"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true
},
"extra": {
"drupal-scaffold": {
"locations": {
"web-root": "web/"
}
},
"installer-paths": {
"web/core": [
"type:drupal-core"
],
"web/libraries/{$name}": [
"type:drupal-library"
],
"web/modules/contrib/{$name}": [
"type:drupal-module"
],
"web/profiles/contrib/{$name}": [
"type:drupal-profile"
],
"web/themes/contrib/{$name}": [
"type:drupal-theme"
],
"drush/Commands/contrib/{$name}": [
"type:drupal-drush"
],
"web/modules/custom/{$name}": [
"type:drupal-custom-module"
],
"web/themes/custom/{$name}": [
"type:drupal-custom-theme"
]
},
"drupal-core-project-message": {
"include-keys": [
"homepage",
"support"
],
"post-create-project-cmd-message": [
"<bg=blue;fg=white> </>",
"<bg=blue;fg=white> Congratulations, you’ve installed the Drupal codebase </>",
"<bg=blue;fg=white> from the drupal/recommended-project template! </>",
"<bg=blue;fg=white> </>",
"",
"<bg=yellow;fg=black>Next steps</>:",
" * Install the site: https://www.drupal.org/docs/8/install",
" * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
" * Get support: https://www.drupal.org/support",
" * Get involved with the Drupal community:",
" https://www.drupal.org/getting-involved",
" * Remove the plugin that prints this message:",
" composer remove drupal/core-project-message"
]
}
}
}
drush pmu XXX
and then remove it from the filesystem withcomposer remove YYY
composer remove drupal/pdf_reader
after you successfully disabled the module. If you somehow can't disable please report it as a bug including the steps to reproduce it in a fresh installation to the module's issue queue on drupal.org.