Error messages when running composer install, after switching from Drupal core 9.2.x to 9.1.x
Closed this issue · 10 comments
There is no issue running the steps below when starting a new project with git -
git clone https://git.drupalcode.org/project/drupal.git
cd drupal
composer install
(installs drupal 9.2.x by default)git checkout 9.1.x
composer install
The steps above, running both composer Install
go smooth with no errors.
But when running similar commands using this repo as a base, results in error -
Steps to reproduce:
composer create-project joachim-n/drupal-core-development-project
(will install drupal 9.2.x by default)cd repos/drupal
git checkout 9.1.x
composer install
error message:
Generating autoload files
Could not scan for classes inside "core/lib/Drupal.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Component/DependencyInjection/Container.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Component/FileCache/FileCacheFactory.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Component/Utility/Timer.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Component/Utility/Unicode.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/Cache/Cache.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/Cache/CacheBackendInterface.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/Cache/CacheTagsChecksumInterface.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/Cache/CacheTagsChecksumTrait.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/Cache/CacheTagsInvalidatorInterface.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/Cache/DatabaseBackend.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/Database/Connection.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/Database/Database.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/Database/Driver/mysql/Connection.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/Database/Statement.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/Database/StatementInterface.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/DependencyInjection/Container.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/DrupalKernel.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/DrupalKernelInterface.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/Installer/InstallerRedirectTrait.php" which does not appear to be a file nor a folder
Could not scan for classes inside "core/lib/Drupal/Core/Site/Settings.php" which does not appear to be a file nor a folder
Class Drupal\Core\Composer\Composer is not autoloadable, can not call pre-autoload-dump script
[RuntimeException]
Could not scan for classes inside "core/lib/Drupal.php" which does not appear to be a file nor a fold
er
install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-scripts] [--no-progress] [--no-install] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [<packages>]...
Running composer update
instead of the last composer install
, runs smoothly, no errors.
I used to see this error message a lot on another project. BLT has the same issue too: acquia/blt#3148
Thank you @joachim-n!
Is there a workaround? a better way to do it?
Once a project is installed with 9.2.x, and I want to work on a different version of core, what are the correct steps to change it?
So far what I've done is switch to a different version of core in repos/drupal, then run composer update
.
This looks like it's going to be really hard to fix, given what's been said on that BLT ticket.
Are you using Composer 2?
Yes, I am using Composer 2.
composer.json
in this repo includes this line -
"drupal/core-composer-scaffold": "^8.9"
(#L33)
When working on Drupal 9.x branch (in drupal/repos
), should that line of core-composer-scaffold
be adjusted as well?
Yes, that should possibly match the version of core. I'll try to find time to investigate.
I get lots of:
Could not scan for classes inside "/Users/joachim/Sites/drupal-core-composer-test/vendor/drupal/core/lib/Drupal.php" which does not appear to be a file nor a folder
but after several of those, it says:
Loading composer repositories with package information
Updating dependencies
and it doesn't crash.
It still gives me that error when I do composer show
.
I've changed the drupal/core-composer-scaffold requirement to *, so it keeps in sync with core.
I just changed the core repo to 9.3.x, did composer update
, all fine.
Then changed the core repo to 9.3.x, did `composer update, all fine.
Lots of the 'Could not scan for classes' error, but it works.
I'll update the README.
@joachim-n Should this issue be closed? is the official solution is running composer update
instead of composer install
, when switching to a different major branch of Drupal core?