Problem/Motivation
I posted this to the only reference I could find in regards to the merge request it is running (https://www.drupal.org/project/drupal/issues/3115054) but I need to get my site online.
When I try to do my composer update I get the following:
Gathering patches for dependencies. This might take a minute.
- Installing drupal/core (9.3.11): Cloning b8978dd6a4 from cache
- Applying patches for drupal/core
https://git.drupalcode.org/project/drupal/-/merge_requests/1427.diff (Media library widget forgets ordering when adding or removing items)
Could not apply patch! Skipping. The error was: Cannot apply patch https://git.drupalcode.org/project/drupal/-/merge_requests/1427.diff
In Patches.php line 326:
Cannot apply patch Media library widget forgets ordering when adding or removing items (https://git.drupalcode.org/project/drupal/-/merge_requests/1427.diff)!
I have pulled all of the drupal/core patches from my composer file but still no luck.
Steps to reproduce
Run composer update --with-all-dependencies
Comments
Comment #2
cilefen commentedYou have a patch there that doesn't apply any more.
It's marked as fixed. It's probably in the release, which is why the patch does not apply.
Comment #3
cilefen commentedYes, it's in 9.3.10: https://www.drupal.org/project/drupal/releases/9.3.10
You no longer need the patch.
Comment #4
Christopher Riley commentedI have a ton of patches is there a way to identify which one might be doing it? I already pulled all of the core patches but that didn't fix it. I am now doing the update with no patches at all to see if that at least works. Anyone have a way of identifying which patch it could be?
Just finished running the update with no patches and I am still getting the same error.
Comment #5
cilefen commentedIt will be the one that says "Media library widget forgets ordering when adding or removing items" next to it ;-).
Comment #6
Christopher Riley commentedI ran composer in verbose mode and got the following:
> pre-package-install: cweagans\Composer\Patches->gatherPatches
Patches already gathered. Skipping
- Installing drupal/taxonomy_machine_name (dev-1.x 3165f5f): Cloning 3165f5faa95c0fad7829aca30eeefef2eff3ca64 from cache
> post-package-install: Wikimedia\Composer\Merge\V2\MergePlugin->onPostPackageInstall
> post-package-install: cweagans\Composer\Patches->postInstall
- Applying patches for drupal/core
https://git.drupalcode.org/project/drupal/-/merge_requests/1427.diff (Media library widget forgets ordering when adding or removing items)
Testing ability to patch with git apply. This command may produce errors that can be safely ignored.
git -C 'public_html/core' apply --check -v '-p2' '/tmp//6258551bc0cec.patch'
Checking patch modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php...
error: while searching for:
* The form state.
*/
public static function removeItem(array $form, FormStateInterface $form_state) {
$triggering_element = $form_state->getTriggeringElement();
// Get the parents required to find the top-level widget element.
if (count($triggering_element['#array_parents']) < 4) {
error: patch failed: modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php:744
error: modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php: patch does not apply
Checking patch modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php...
error: while searching for:
namespace Drupal\Tests\media_library\FunctionalJavascript;
use Drupal\field\Entity\FieldConfig;
/**
* Tests the Media library entity reference widget.
error: patch failed: modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php:3
error: modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php: patch does not apply
patch '-p2' --no-backup-if-mismatch -d 'public_html/core' < '/tmp//6258551bc0cec.patch'
patch: unrecognized option `--no-backup-if-mismatch'
usage: patch [-bCcEeflNnRstuv] [-B backup-prefix] [-D symbol] [-d directory]
[-F max-fuzz] [-i patchfile] [-o out-file] [-p strip-count]
[-r rej-name] [-V t | nil | never | none] [-x number]
[-z backup-ext] [--posix] [origfile [patchfile]]
patch
Could not apply patch! Skipping. The error was: Cannot apply patch https://git.drupalcode.org/project/drupal/-/merge_requests/1427.diff
In Patches.php line 326:
[Exception]
Cannot apply patch Media library widget forgets ordering when adding or removing items (https://git.drupalcode.org/project/drupal/-/merge_requests/1427.diff)!
Exception trace:
at /home/sites/sitename.com/vendor/cweagans/composer-patches/src/Patches.php:326
cweagans\Composer\Patches->postInstall() at n/a:n/a
call_user_func() at phar:///usr/local/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:202
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:144
Composer\EventDispatcher\EventDispatcher->dispatchPackageEvent() at phar:///usr/local/bin/composer.phar/src/Composer/Installer/InstallationManager.php:460
Composer\Installer\InstallationManager->Composer\Installer\{closure}() at phar:///usr/local/bin/composer.phar/src/Composer/Installer/InstallationManager.php:475
Composer\Installer\InstallationManager->executeBatch() at phar:///usr/local/bin/composer.phar/src/Composer/Installer/InstallationManager.php:390
Composer\Installer\InstallationManager->downloadAndExecuteBatch() at phar:///usr/local/bin/composer.phar/src/Composer/Installer/InstallationManager.php:282
Composer\Installer\InstallationManager->execute() at phar:///usr/local/bin/composer.phar/src/Composer/Installer.php:759
Composer\Installer->doInstall() at phar:///usr/local/bin/composer.phar/src/Composer/Installer.php:588
Composer\Installer->doUpdate() at phar:///usr/local/bin/composer.phar/src/Composer/Installer.php:279
Composer\Installer->run() at phar:///usr/local/bin/composer.phar/src/Composer/Command/UpdateCommand.php:241
Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer.phar/vendor/symfony/console/Command/Command.php:298
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php:1015
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php:299
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer.phar/src/Composer/Console/Application.php:334
Composer\Console\Application->doRun() at phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php:171
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer.phar/src/Composer/Console/Application.php:130
Composer\Console\Application->run() at phar:///usr/local/bin/composer.phar/bin/composer:88
require() at /usr/local/bin/composer.phar:29
update [--with WITH] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-dev] [--lock] [--no-install] [--no-autoloader] [--no-suggest] [--no-progress] [-w|--with-dependencies] [-W|--with-all-dependencies] [-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] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [
...]
This is on a FreeBSD 13 system and --no-backup-if-mismatch is not recognized so how do I get around that?
Comment #7
cilefen commentedRemove whatever (usually in Composer.json) is trying to apply the patch called "Media library widget forgets ordering when adding or removing items".
Comment #8
Christopher Riley commentedI finally figured it out sorry to raise such a fuss. The module media_library_media_modify was applying the patch and causing all of the grief.