1

I am attempting to update a Drupal 9.5 site to Drupal 10. Upgrade status says 100% ready PHP is 8.1.25 Webserver is nginx 1.18 MYSQL is 8.0.35-0ubuntu0.22.04.1 - (Ubuntu)

Following instructions here: https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-later/upgrading-a-composer-based-site

The composer update step completes, then php errors.

Details. Composer gets this far...

68/68 [============================] 100%
In FilesystemRepository.php line 163:

  file_get_contents(/srv/sid2/vendor/composer/composer/src/Composer/Repository/../InstalledVersions.php): Failed to open stream: No such file or
   directory

After that, any Composer or Drush command I try to execute does this...(srv/sid2/web is the document root for the site)

PHP Warning:  

    require(/srv/sid2/vendor/composer/../guzzlehttp/promises/src/functions_include.php): Failed to open stream: No such file or directory in /srv/sid2/vendor/composer/autoload_real.php on line 82
    PHP Fatal error:  Uncaught Error: Failed opening required '/srv/sid2/vendor/composer/../guzzlehttp/promises/src/functions_include.php' (include_path='/srv/sid2/vendor/pear/archive_tar:/srv/sid2/vendor/pear/console_getopt:/srv/sid2/vendor/pear/pear-core-minimal/src:/srv/sid2/vendor/pear/pear_exception:.:/usr/share/php') in /srv/sid2/vendor/composer/autoload_real.php:82
    Stack trace:
    #0 /srv/sid2/vendor/composer/autoload_real.php(65): composerRequireadb589663ee65f2462c8612df87cae83()
    #1 /srv/sid2/vendor/autoload.php(7): ComposerAutoloaderInitadb589663ee65f2462c8612df87cae83::getLoader()
    #2 /srv/sid2/vendor/drush/drush/drush.php(58): include_once('...')
    #3 /srv/sid2/vendor/drush/drush/drush(4): require('...')
    #4 /srv/sid2/vendor/bin/drush(120): include('...')
    #5 {main}
      thrown in /srv/sid2/vendor/composer/autoload_real.php on line 82

The site does not load of course.

What has me thinking I have a php include_path problem is this part: (include_path='/srv/sid2/vendor/pear/archive_tar:/srv/sid2/vendor/pear/console_getopt:/srv/sid2/vendor/pear/pear-core-minimal/src:/srv/sid2/vendor/pear/pear_exception:.:/usr/share/php')

But I don't understand php and/or Composer well enough to know what's gone wrong here or what the include_path needs to be to allow PHP to find all the stuff it's looking for.

But maybe I'm on the wrong track?

The first error, failing to find InstalledVersions.php: The file exists, but it's in /vendor/composer/composer/src/Composer not /vendor/composer/composer/src/Composer/Repository/../ (By the way, what does "/../" mean?)

Composer info:

which composer, outside any Drupal projects, returns: /usr/local/bin/composer

which composer inside one of my other projects (not yet upgraded) returns ./vendor/bin/composer

composer why composer/composer inside other projects returns drupal/core-dev 9.5.0 requires composer/composer (^2.2.12)

Inside a working project, composer -V indicates version 2.2.22. Globally, I get 2.5.4

Inside the failed upgrade project, all composer commands (so far) result in the errors already noted above.

1 Answer 1

2

This is a composer issue. Normally composer is installed globally

which composer

should return /usr/local/bin/composer. This is a global path for Drupal even if Linux considers it as local. If it doesn't return a path outside of the Drupal project then follow the install instructions https://getcomposer.org/download/

If you have a composer dependency locally

composer why composer/composer

then composer is part of your project, probably because of the dev package. If you don't need it remove the dev package. Otherwise, update the local composer in an extra step before updating Drupal:

composer update composer/composer

Also, when running into composer problems first try to update the global composer:

composer self-update
10
  • Thanks. I have added composer info to the question. When I do composer update composer/composer inside a non-broken project, it says nothing to update. Globally, it updated from 2.5.4 to 2.6.5. The local one is 2.2.22.
    – aharown07
    Commented Nov 3, 2023 at 12:31
  • It could be that you are not able to update composer/composer because of dependencies. Then remove composer/composer 2.2.22 by removing the dev package composer remove drupal/core-dev - You can re-install the dev package after the update if you need it.
    – 4uk4
    Commented Nov 3, 2023 at 12:51
  • Another way to avoid the problem in your case would be to remove ./vendor/bin/ from your .bashrc PATH variable.
    – 4uk4
    Commented Nov 3, 2023 at 12:55
  • composer remove drupal/core-dev generated errors.... 38/49 [=====================>------] 77%PHP Fatal error: Uncaught Error: Class "React\Promise\RejectedPromise" not found in /srv/sid1/vendor/react/promise/src/FulfilledPromise.php:30 Stack trace: #0 /srv/sid1/vendor/react/promise/src/Promise.php(134): React\Promise\FulfilledPromise->then() #1 /srv/sid1/vendor/react/promise/src/Promise.php(168): React\Promise\Promise::React\Promise\{closure}() etc. (Another test site. This one has /src/sid1/web as doc root)
    – aharown07
    Commented Nov 3, 2023 at 18:17
  • I'm adding my composer.json to the question. Something seems likely to be wrong in there.
    – aharown07
    Commented Nov 3, 2023 at 18:31

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.