0

When I am trying to upgrade module or theme via Composer, I get this exception.

Fatal error: Cannot redeclare config_get_config_directory() (previously declared in D:\xampp\htdocs\itdlocal_test\web\core\includes\bootstrap.inc:214) in D:\xampp\htdocs\itdlocal_test\web\vendor\drupal\core\includes\bootstrap.inc on line 214

Please let me know on the fix for the error. I have tried removing the lock file and vendor folder but the issue not rectified when we are trying to run composer update.

My composer.json is the following.

{
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
          "type": "package",
          "package": {
            "name": "ckeditor/find",
            "version": "4.8.0",
            "type": "drupal-library",
            "extra": {
              "installer-name": "find"
            },
            "dist": {
              "url": "https://download.ckeditor.com/find/releases/find_4.8.0.zip",
              "type": "zip"
            }
          }
        }
    ],
    "require": {
        "composer/installers": "^1.2",
        "cweagans/composer-patches": "^1.6",
        "drupal/addtoany": "1.16",
        "drupal/admin_toolbar": "^2.0",
        "drupal/advagg": "^4.1",
        "drupal/anchor_link": "^2.4",
        "drupal/auto_entitylabel": "^3.0",
        "drupal/autologout": "^1.3",
        "drupal/better_exposed_filters": "^4.0",
        "drupal/blazy": "^2.0",
        "drupal/block_class": "2.0",
        "drupal/block_token": "1.x-dev",
        "drupal/blockgroup": "1.5",
        "drupal/blocktabs": "^1.0",
        "drupal/chosen": "^2.9",
        "drupal/ckeditor_accordion": "^1.2",
        "drupal/ckeditor_copyformatting": "^1.0",
        "drupal/ckeditor_find": "^1.0@beta",
        "drupal/ckeditor_font": "1.3",
        "drupal/ckeditor_liststyle": "^1.3",
        "drupal/ckeditor_media_embed": "1.11",
        "drupal/ckeditor_pastefromword": "^1.0",
        "drupal/ckeditor_rm": "^6.0",
        "drupal/coder": "^8.3",
        "drupal/colorbox": "2.0",
        "drupal/colorbox_load": "1.2",
        "drupal/colorbutton": "^1.1",
        "drupal/config_ignore": "^2.2",
        "drupal/config_log": "^2.1",
        "drupal/content_export_csv": "^3.0@beta",
        "drupal/content_language_access": "^1.1",
        "drupal/content_moderation_notifications": "^3.2",
        "drupal/core-composer-scaffold": "^8.8",
        "drupal/core-project-message": "^8.8",
        "drupal/core-recommended": "^8.8",
        "drupal/core-vendor-hardening": "^8.8",
        "drupal/crop": "^2.0",
        "drupal/csv_importer": "^1.6",
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "sort-packages": true,
        "allow-plugins": {
            "composer/installers": true,
            "cweagans/composer-patches": true,
            "drupal/core-composer-scaffold": true,
            "drupal/core-project-message": true,
            "drupal/core-vendor-hardening": false
        }
    },
    "enable-patching": true,
    "extra": {
        "drupal-scaffold": {
            "locations": {
                "web-root": "./"
            }
        },
        "patches": {
            "drupal/core": {
                "Drupal core patch for enabling exposed filter": "https://www.drupal.org/files/issues/2019-09-30/2681947-33.patch",
                "Allow exposed form to preserve URL query parameters": "https://www.drupal.org/files/issues/2020-02-04/2681953-23.patch"
            },
            "drupal/blocktabs": {
                "Views Ajax not working in block tabs": "https://www.drupal.org/files/issues/2019-10-24/blocktabs-preview-2992052-2.patch"
            },
            "drupal/videojs": {
                "In videojs changed the js files in librariesyml": "patches/videojs_library.patch"
            },
            "drupal/admin_toolbar": {
                "'admin_toolbar - Multi column": "patches/added-multi-column-menu-dropdown-2917168-20.patch"
            },
            "drupal/better_exposed_filters": {
                "preserve URL query parameters for bef": "patches/preserv_query_param.patch"
            },
            "drupal/SMTP": {
                "Invalid mail address" : "patches/SMTP_mail.patch"
            },
            "drupal/token_for_file_name_without_extension": {
                "Token for displaying Filename excluding the file extension":"patch_for_tokens_filename_without_extension.patch"
            },
            "drupal/chosen_dropdown_expand_dropdown_on_spacebar_press": {
                "Expanding the chosen dropdown on click of spacebar":"do_not_autosubmit_chosenjs_search.patch"
            }
        },
        "installer-paths": {
            "core": ["type:drupal-core"],
            "libraries/{$name}": ["type:drupal-library"],
            "modules/contrib/{$name}": ["type:drupal-module"],
            "profiles/contrib/{$name}": ["type:drupal-profile"],
            "themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/Commands/contrib/{$name}": ["type:drupal-drush"],
            "modules/custom/{$name}": ["type:drupal-custom-module"],
            "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/legacy-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"
            ]
        }
    }
}
5
  • Did you have a failed composer install at some point? As it sounds like you have core in both places, /vendor folder and in /web. You could try manually deleting D:\xampp\htdocs\itdlocal_test\web\vendor\drupal\core Commented Dec 2, 2022 at 13:48
  • Hi, Deleting the core inside vendor manually and run composer update again is your suggestion? Please confirm?
    – user106559
    Commented Dec 2, 2022 at 13:50
  • Yeah, when composer downloads core it initially goes into the vendor folder and then gets moved to the right place. You have core in the right place but somehow still have a copy in the vendor folder Commented Dec 2, 2022 at 13:56
  • I have tried removing the core folder inside vendor and ran composer install but the same folder is again getting created inside vendor.
    – user106559
    Commented Dec 2, 2022 at 14:20
  • If your web root is set to "web-root": "./" you need to delete the old web/ dir: rm -rf web.
    – leymannx
    Commented Dec 4, 2022 at 22:00

1 Answer 1

3

There are two installs of Drupal. You probably said "no" to the Composer extension called composer-installers. Please check the value for composer-installers in the config.allow-plugins section of composer.json. The value you should use is true.

6
  • In my composer.json i am having the following config: "config": { "sort-packages": true, "allow-plugins": { "composer/installers": true, "cweagans/composer-patches": true, "drupal/core-composer-scaffold": true, "drupal/core-project-message": true, "drupal/core-vendor-hardening": false } Also in require i have configured like below: "require": { "composer/installers": "^1.2",
    – user106559
    Commented Dec 2, 2022 at 13:09
  • Can you please tell if anything needs to be checked or changed.
    – user106559
    Commented Dec 2, 2022 at 13:15
  • You should post the entire composer.json file into the question above and also confirm the version of Composer.
    – mona lisa
    Commented Dec 2, 2022 at 13:17
  • I have posted my entire composer.json and also i have mentioned the composer version i use. Please help!
    – user106559
    Commented Dec 2, 2022 at 13:27
  • You're running composer install/update command inside of /xampp/htdocs/itdlocal_test and not inside the vendor directory, right?
    – No Sssweat
    Commented Dec 12, 2022 at 3:45

Your Answer

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