Drupal 9 - composer update causes drush php Cannot redeclare error

Andy Wits Blog

Drupal 9 - composer update causes drush php Cannot redeclare error

I installed the latest updates of the Drupal 9 core and modules from version 9.3 to 9.5. At the same time, a bug appeared - composer ignores the json settings and puts them in the drupal core folder in the vendor folder, and not where it should be. As a result, the site stops working normally and when trying to go to any page, it causes a redirect to /core/install.php.

The logs show something like:

PHP Fatal error:  Cannot redeclare config_get_config_directory() (previously declared in /home/***/public_html/****/core/includes/bootstrap.inc

What helped: deleting the vendor folder and composer.lock and changing "composer/installers": false to true in composer.json

"config": {
"sort-packages": true,
"allow-plugins": {
"composer/installers":
true,
"cweagans/composer-patches": true,
"drupal/core-composer-scaffold": true,
"drupal/core-project-message": true

After which I reinstalled everything with the command:

composer install
Published on Sep 05 2023 at 12:00 am
Time to read 1 minute(s)
Categories
  • Web Development

Contact me on