Score:0

"composer install" works during upgrade but the autoload file is missing in the vendor directory

eg flag

I am upgrading a Drupal 8 site to Drupal 9. I removed the core, vendor, modules, and contrib directories; I ran composer install. All went well, but when I refreshed the page, I saw the following error.

Warning: require(/app/docroot/../vendor/autoload.php): failed to open stream: No such file or directory in /app/docroot/autoload.php on line 16 Fatal error: require(): Failed opening required '/app/docroot/../vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /app/docroot/autoload.php on line 16

The content of the composer.json file is the following one.

{
    "name": "acquia/blt-project",
    "type": "project",
    "description": "Project template for Drupal 8 sites built with BLT.",
    "license": "GPL-2.0-only",
    "require": {
        "php": ">=7.1",
        "ext-curl": "*",
        "acquia/blt": "^12",
        "acquia/drupal-spec-tool": "*",
        "acquia/memcache-settings": "*",
        "composer/installers": "^1.9",
        "cweagans/composer-patches": "^1.7",
        "d8-contrib-modules/cloudflarephpsdk": "^1.0@alpha",
        "drupal/acquia_connector": "^3.0",
        "drupal/acquia_purge": "^1.1",
        "drupal/acquia_search": "^3.0.0",
        "drupal/admin_toolbar": "^2.0",
        "drupal/admin_toolbar_tools": "^2.0",
        "drupal/asset_injector": "^2.7",
        "drupal/ckeditor_accordion": "^1.3",
        "drupal/cloudflare": "^1.0@beta",
        "drupal/codemirror_editor": "^1.7",
        "drupal/cog": "^1.0.0",
        "drupal/color_field": "^2.0",
        "drupal/config_split": "^1.0.0",
        "drupal/console": "~1.0",
        "drupal/core": "^9.0.0",
        "drupal/core-composer-scaffold": "^9.0.0",
        "drupal/core-project-message": "^9.0.0",
        "drupal/core-recommended": "^9.0.0",
        "drupal/css_editor": "^1.3",
        "drupal/ctools": "^3.7",
        "drupal/devel": "^4.1",
        "drupal/devel_entity_updates": "^3.0",
        "drupal/draggableviews": "^2.0",
        "drupal/dropzonejs": "^2.0",
        "drupal/entity_clone": "^1.0@beta",
        "drupal/entityqueue": "^1.0@beta",
        "drupal/features": "^3.8.0",
        "drupal/feeds": "^3.0@alpha",
        "drupal/feeds_ex": "^1.0@alpha",
        "drupal/feeds_tamper": "^2.0@beta",
        "drupal/field_css": "^2.0@RC",
        "drupal/filefield_paths": "^1.0",
        "drupal/force_password_change": "^2.0@beta",
        "drupal/group": "^1.3",
        "drupal/groupmedia": "^2.0.0-alpha10",
        "drupal/imce": "^2.4",
        "drupal/inline_entity_form": "^1.0@RC",
        "drupal/layout_builder_component_attributes": "^1.2",
        "drupal/layout_builder_modal": "^1.1",
        "drupal/layout_builder_restrictions": "^2.9",
        "drupal/layout_builder_styles": "^1.0@beta",
        "drupal/layout_library": "^1.0@beta",
        "drupal/ldap_auth": "^1.25.0",
        "drupal/lightning_core": "^5.5",
        "drupal/maxlength": "^1.0",
        "drupal/media_directories": "^2.0.1",
        "drupal/media_entity_file_replace": "^1.0@beta",
        "drupal/menu_delete": "^2.2",
        "drupal/menu_export": "^1.3",
        "drupal/menu_item_extras": "^2.8",
        "drupal/metatag": "^1.16",
        "drupal/mini_layouts": "^1.0@alpha",
        "drupal/module_filter": "^3.1",
        "drupal/multiple_fields_remove_button": "^1.0@alpha",
        "drupal/n1ed": "^2.44",
        "drupal/openapi_jsonapi": "^3.0",
        "drupal/openapi_rest": "^2.0",
        "drupal/openapi_ui": "^1.0",
        "drupal/openapi_ui_redoc": "^1.0@RC",
        "drupal/openapi_ui_swagger": "^1.0@RC",
        "drupal/paragraphs": "^1.12",
        "drupal/pathauto": "^1.6",
        "drupal/purge": "^3.1",
        "drupal/qa_accounts": "^1.0.0-alpha1",
        "drupal/readonly_field_widget": "^1.3",
        "drupal/rest_menu_items": "^3.0.2",
        "drupal/restui": "^1.17",
        "drupal/schema_metatag": "^2.2",
        "drupal/shield": "^1.2.0",
        "drupal/smtp": "^1.0",
        "drupal/structure_sync": "^2.0",
        "drupal/svg_image": "^1.15",
        "drupal/svg_image_field": "^1.3",
        "drupal/tome": "^1.4",
        "drupal/twig_debugger": "^1.1",
        "drupal/view_unpublished": "^1.0@alpha",
        "drush/drush": "@stable"
    },
    "require-dev": {
        "drupal/upgrade_status": "^3.4",
        "geerlingguy/drupal-vm": "~5.0"
    },
    "config": {
        "platform": {
            "php": "7.4"
        },
        "sort-packages": true
    },
    "extra": {
        "composer-exit-on-patch-failure": true,
        "drupal-scaffold": {
            "locations": {
                "web-root": "docroot/"
            },
            "initial": {
                "sites/default/default.services.yml": "sites/default/services.yml",
                "sites/default/default.settings.php": "sites/default/settings.php"
            },
            "file-mapping": {
                "[web-root]/.htaccess": false
            }
        },
        "enable-patching": true,
        "installer-paths": {
            "docroot/core": [
                "type:drupal-core"
            ],
            "docroot/modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "docroot/modules/custom/{$name}": [
                "type:drupal-custom-module"
            ],
            "docroot/profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "docroot/profiles/custom/{$name}": [
                "type:drupal-custom-profile"
            ],
            "docroot/themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "docroot/themes/custom/{$name}": [
                "type:drupal-custom-theme"
            ],
            "docroot/libraries/{$name}": [
                "type:drupal-library",
                "type:bower-asset",
                "type:npm-asset",
                "swagger-api/swagger-ui"
            ],
            "drush/Commands/{$name}": [
                "type:drupal-drush"
            ]
        },
        "installer-types": [
            "bower-asset",
            "npm-asset"
        ],
        "patchLevel": {
            "drupal/core": "-p2"
        },
        "patches": {
            "drupal/metatag": {
                "#93 - 2945817-93.patch": "https://www.drupal.org/files/issues/2020-02-29/2945817-93.patch"
            },
            "drupal/media_directories": {
                "#3 - Fix some issues": "https://www.drupal.org/files/issues/2021-06-16/3219025--garden-gnome-package.patch"
            },
            "drupal/rest_menu_items": {
                "#13 - Return custom fields in api": "https://www.drupal.org/files/issues/2021-03-15/3039979-menu-items-extras-13.patch"
            },
            "drupal/force_password_change" : {
                "#4 - 3222291-4.patch" : "https://www.drupal.org/files/issues/2021-07-16/3222291-4.patch"
            }
        }
    },
    "autoload": {
        "psr-4": {
            "Example\\": "blt/src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Drupal\\Tests\\PHPUnit\\": "tests/phpunit/src/"
        }
    },
    "repositories": {
        "drupal": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        "asset-packagist": {
            "type": "composer",
            "url": "https://asset-packagist.org"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-create-project-cmd": [
            "blt internal:create-project:init-repo"
        ],
        "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
        "nuke": [
            "rm -rf vendor composer.lock docroot/core docroot/modules/contrib docroot/profiles/contrib docroot/themes/contrib",
            "@composer clearcache --ansi",
            "@composer install --ansi"
        ]
    }
}

How can I fix this autoload issue?

john Smith avatar
gr flag
and in your filesystem the vendor folder with the autoload.php exists? probably this path `/app/docroot/` is not correct, is `app` actually a folder in the root of your fs?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.