Composer install works during upgrade but autoload file is missing in vendor

Am moving a D8 site to Drupal 9. I removed the core, vendor, modules contrib folder, and ran composer install. All went well, but when I refresh the page, I see 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 

My composer.json looks like the following:

{     "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?

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Composer install works during upgrade but autoload file is missing in vendor

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.