I have a Drupal 8.5.3 site (built from the composer project) that was previously on the 8.3 branch before the critical security updates forced me to update to 8.5. One of the things I missed in the upgrade is that the Media module has moved to core and has its own upgrade instructions. So as I look through those instructions, I have steps 1-5 covered and need to upgrade the codebase. I should also say that the site has heavy usage of the Media module with content and paragraph fields.
So after going through the process[1] of getting the right versions of the right modules in place, when I try to updb
, I get this error message:
In order to run the Media Entity 2.x upgrade, please uninstall and remove from the codebase the contributed "Media" module.
Before continuing, please make sure all modules that provide plugins for Media Entity (or depend on it) have their code updated to their respective 2.x branches. Note that you will probably need to revert to the 1.x branch of the Media Entity module if you want to uninstall existing plugin modules. The following modules depend on media entity and need to be either upgraded or uninstalled: media.
If I do a cr
or try to pm-uninstall media
, I get a long error message[3].
What am I doing wrong, and how can I get updated? I feel like this is quite a mess and I wonder if it'd be better to spin up a new 8.5.3 site and migrate content over. Though I'm sure I would run into configuration problems with my existing sets of media fields.
Update
Thanks to @sonfd's clue, I was finally able to get this upgraded. It was a pretty tedious process that I'm going to lay out in a blog post soon.
Update 2
Wrote up a blog post to lay out how I resolved this issue. Maybe it will help others. Definitely lays out my newly-gained scar from not reading upgrade instructions and changelogs more closely.
[1]:
/usr/bin/php -d memory_limit=-1 /usr/local/bin/composer remove drupal/media
# (NOTE: If I don't remove drupal/media first, I get a composer install error[2])
/usr/bin/php -d memory_limit=-1 /usr/local/bin/composer require \
drupal/inline_entity_form drupal/crop:2.x-dev drupal/media_entity_instagram:2.x-dev \
drupal/media_entity:2.x-dev drupal/media_entity_slideshow:2.x-dev \
drupal/media_entity_twitter:2.x-dev drupal/slick_media:2.x-dev \
drupal/media_entity_actions
/usr/bin/php -d memory_limit=-1 /usr/local/bin/composer remove drupal/video_embed_field
/usr/bin/php -d memory_limit=-1 /usr/local/bin/composer update
/usr/bin/php -d memory_limit=-1 /usr/local/bin/composer require drupal/media
[2]:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- drupal/image_widget_crop 2.1.0 requires drupal/crop 1.0 - 2.0 -> satisfiable by drupal/crop[1.x-dev].
- drupal/image_widget_crop 2.1.0 requires drupal/crop 1.0 - 2.0 -> satisfiable by drupal/crop[1.x-dev].
- drupal/image_widget_crop 2.1.0 requires drupal/crop 1.0 - 2.0 -> satisfiable by drupal/crop[1.x-dev].
- Can only install one of: drupal/crop[1.x-dev, 2.x-dev].
- Installation request for drupal/crop 2.x-dev -> satisfiable by drupal/crop[2.x-dev].
- Installation request for drupal/image_widget_crop (locked at 2.1.0) -> satisfiable by drupal/image_widget_crop[2.1.0].
Installation failed, reverting ./composer.json to its original content.
[3]:
$ ../vendor/bin/drush pm-uninstall media
Error: Call to a member function addConstraint() on null in [error]
media_entity_type_alter() (line 72 of
/Users/jason/Sites/artobject/web/modules/contrib/media/media.module)
#0
/Users/jason/Sites/artobject/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(539):
media_entity_type_alter(Array, NULL, NULL)
#1
/Users/jason/Sites/artobject/web/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(333):
Drupal\Core\Extension\ModuleHandler->alter('entity_type', Array)
#2
/Users/jason/Sites/artobject/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php(117):
Drupal\Core\Plugin\DefaultPluginManager->alterDefinitions(Array)
#3
/Users/jason/Sites/artobject/web/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(175):
Drupal\Core\Entity\EntityTypeManager->findDefinitions()
#4
/Users/jason/Sites/artobject/web/core/lib/Drupal/Core/Entity/EntityTypeRepository.php(83):
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()
#5
/Users/jason/Sites/artobject/web/core/lib/Drupal/Core/Entity/Entity.php(523):
Drupal\Core\Entity\EntityTypeRepository->getEntityTypeFromClass('Drupal\\user\\Ent...')
#6
/Users/jason/Sites/artobject/vendor/drush/drush/lib/Drush/User/User8.php(26):
Drupal\Core\Entity\Entity::load(0)
#7
/Users/jason/Sites/artobject/vendor/drush/drush/lib/Drush/Boot/DrupalBoot.php(558):
Drush\User\User8->load_by_uid(0)
#8
/Users/jason/Sites/artobject/vendor/drush/drush/includes/bootstrap.inc(354):
Drush\Boot\DrupalBoot->bootstrap_drupal_login()
#9
/Users/jason/Sites/artobject/vendor/drush/drush/includes/bootstrap.inc(473):
drush_bootstrap(6, 6)
#10
/Users/jason/Sites/artobject/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(59):
drush_bootstrap_to_phase(6)
#11
/Users/jason/Sites/artobject/vendor/drush/drush/includes/preflight.inc(66):
Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#12 /Users/jason/Sites/artobject/vendor/drush/drush/drush.php(12):
drush_main()
#13 {main}.
Error: Call to a member function addConstraint() on null in /Users/jason/Sites/artobject/web/modules/contrib/media/media.module on line 72 #0 /Users/jason/Sites/artobject/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(539): media_entity_type_alter(Array, NULL, NULL)
#1 /Users/jason/Sites/artobject/web/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(333): Drupal\Core\Extension\ModuleHandler->alter('entity_type', Array)
#2 /Users/jason/Sites/artobject/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php(117): Drupal\Core\Plugin\DefaultPluginManager->alterDefinitions(Array)
#3 /Users/jason/Sites/artobject/web/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(175): Drupal\Core\Entity\EntityTypeManager->findDefinitions()
#4 /Users/jason/Sites/artobject/web/core/lib/Drupal/Core/Entity/EntityTypeRepository.php(83): Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()
#5 /Users/jason/Sites/artobject/web/core/lib/Drupal/Core/Entity/Entity.php(523): Drupal\Core\Entity\EntityTypeRepository->getEntityTypeFromClass('Drupal\\user\\Ent...')
#6 /Users/jason/Sites/artobject/vendor/drush/drush/lib/Drush/User/User8.php(26): Drupal\Core\Entity\Entity::load(0)
#7 /Users/jason/Sites/artobject/vendor/drush/drush/lib/Drush/Boot/DrupalBoot.php(558): Drush\User\User8->load_by_uid(0)
#8 /Users/jason/Sites/artobject/vendor/drush/drush/includes/bootstrap.inc(354): Drush\Boot\DrupalBoot->bootstrap_drupal_login()
#9 /Users/jason/Sites/artobject/vendor/drush/drush/includes/bootstrap.inc(473): drush_bootstrap(6, 6)
#10 /Users/jason/Sites/artobject/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(59): drush_bootstrap_to_phase(6)
#11 /Users/jason/Sites/artobject/vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#12 /Users/jason/Sites/artobject/vendor/drush/drush/drush.php(12): drush_main()
#13 {main}
Error: Call to a member function addConstraint() on null in media_entity_type_alter() (line 72 of /Users/jason/Sites/artobject/web/modules/contrib/media/media.module).
drush mecu
(step 7) to check that your have configured things properly?drush mecu
, I get the same error as [3], with the addConstraint() issue.drush updb
? which version of drush are you using?drush updb
. I am using version 8.1.17. Thanks!