Score:0

Composer installation missing files from Core

cn flag

I just attempted to update Drupal 9.2.10 to 9.3.0 using composer and received the following error during the database update.

views module
Update sort_identifier
Failed: Drupal\Component\Plugin\Exception\PluginNotFoundException: The "tag" plugin does not exist. Valid plugin IDs for Drupal\views\Plugin\ViewsPluginManager are: in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of /path/to/home/dir/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

I've used composer to install everything for quite some time now, and up until now everything has run just fine.

Upon further inspection into this error, I noticed that the installation doesn't even have the DiscoveryTrait.php file that is included in the Core 9.3.0 zip.

Furthermore, the installation is a rather complex multi-site install.

What, if any, ramifications would I encounter by copying some of the files from the zip to my local and pushing the changes via git?

Would I need to keep installing this file manually since it doesn't seem to be included in the composer package?

Lastly, why wouldn't this file had been installed after having run the composer update "drupal/*" -w command?

I guess I'm mostly concerned about what other files may be missing from the core at this point too...

cn flag
Do not manually copy files over. Assuming your code is in git, and you have committed all your recent work, I would create a fresh clone of your repo in a separate directory and then run composer install to see if you have the same issue. The whole point of using composer + git is that you should get consistent, reproducible files everywhere, so when that doesn't happen, you should troubleshooting by going back to the source (a fresh git clone) instead of manually copying files.
4uk4 avatar
cn flag
How could DiscoverTrait.php cause an error when it is missing?
Jaypan avatar
de flag
DiscoveryTrait is not missing. As 4k4 has mentioned, it's what is throwing your error. Try running `composer install` again. It will add any missed files.
Kevin avatar
in flag
Also `composer update "drupal/*" -w` probably not the best thing to run all at once. I would do updates to core and contrib in smaller batches.
Score:1
cn flag

The issue lied in my root .gitignore file where I had cache/ marked as a directory to ignore. I guess when I first set up that ignore file I didn't realize that that line would also exclude /path/to/public/core/modules/views/src/Plugin/views/cache and all of its contents, which is where Tag.php resides and is the actual plugin that it was looking for.

So for anyone that is seeing this, if you have a cache folder that you want to ignore from your root directory, make sure you add !*/core/**/cache/ to include any core cache files.

Christoph Burschka avatar
cn flag
The safest way to use .gitignore is usually to use relative paths like `./cache` (or to make a separate .gitignore in `cache/` that just contains `.`. (Also, checking the files downloaded by composer into git in the first place might not be optimal, though it seems to be quite common.)
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.