Score:-2

Errors Thrown by Composer and Drupal Core

us flag

I'm working as a part of a development team where my colleagues (team members) work in separate Git branches created out of and then merging their branches into a common development branch, develop.

After fetching, checking out and pulling the latest changes in one of their branches and clearing the cache using Drush, I get the below errors in Git bash. These errors also started appearing when I visited my site's homepage's URL in the browser.

PHP Warning:  require(C:\xampp\htdocs\drupal9\vendor\composer/../../web/core/includes/bootstrap.inc): failed to open stream: No such file or directory in C:\xampp\htdocs\drupal9\vendor\composer\autoload_real.php on line 45
PHP Fatal error:  require(): Failed opening required 'C:\xampp\htdocs\drupal9\vendor\composer/../../web/core/includes/bootstrap.inc' (include_path='C:\xampp\htdocs\drupal9\vendor/pear/archive_tar;C:\xampp\htdocs\drupal9\vendor/pear/console_getopt;C:\xampp\htdocs\drupal9\vendor/pear/pear-core-minimal/src;C:\xampp\htdocs\drupal9\vendor/pear/pear_exception;C:\xampp\php\PEAR') in C:\xampp\htdocs\drupal9\vendor\composer\autoload_real.php on line 45

Warning: require(C:\xampp\htdocs\drupal9\vendor\composer/../../web/core/includes/bootstrap.inc): failed to open stream: No such file or directory in C:\xampp\htdocs\drupal9\vendor\composer\autoload_real.php on line 45

Fatal error: require(): Failed opening required 'C:\xampp\htdocs\drupal9\vendor\composer/../../web/core/includes/bootstrap.inc' (include_path='C:\xampp\htdocs\drupal9\vendor/pear/archive_tar;C:\xampp\htdocs\drupal9\vendor/pear/console_getopt;C:\xampp\htdocs\drupal9\vendor/pear/pear-core-minimal/src;C:\xampp\htdocs\drupal9\vendor/pear/pear_exception;C:\xampp\php\PEAR') in C:\xampp\htdocs\drupal9\vendor\composer\autoload_real.php on line 45

Usually I can fix errors but I don't how to fix the above since PHP has pointed out files which are in the vendor folder, created by Composer for all project dependencies, and Drupal core folder. Trying to debug each error by modifying code in each dependency's and core folder's source code would not be a good idea because that is not the standard approach to fixing errors thrown by Composer and Drupal.

Can anyone please help me?

The Drupal core version is 9.1.0.

Score:0
us flag

Okay, I was able to fix all the errors in one go. I simply executed composer update and Composer pulled in all the missing dependencies in composer.json added by my colleagues and the errors went away. Cheers. :)

Greg W avatar
ai flag
You should be running composer install, not update. That will install all the packages at the specified versions listed in the composer.lock file, which should be in source control too.
I sit in a Tesla and translated this thread with Ai:

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.