This is generally how I update Drupal core:
composer update drupal/core --with-dependencies
However, today when I do this, it is also upgrading the contrib modules. I want to upgrade the core only.
Here is the first part of my composer.json:
{
"name": "drupal/drupal",
"description": "Drupal is an open source content management platform powering millions of websites and applications.",
"type": "project",
"license": "GPL-2.0-or-later",
"require": {
"wikimedia/composer-merge-plugin": "^1.4",
"drupal/entity_clone": "^1.0@beta",
"drupal/features": "^3.8",
"drupal/metatag": "^1.8",
"drupal/webform": "^5.1",
"drupal/config_installer": "^1.8",
"drupal/entity_browser": "^2.1",
"drupal/media_entity_browser": "^1.0@beta",
"drupal/entity_embed": "^1.0@beta",
"drupal/file_browser": "^1.1",
"drupal/admin_menu_search": "^1.0",
"drupal/backup_migrate": "^4.0",
"drupal/block_field": "^1.0@alpha",
"drupal/contact_block": "^1.4",
"drupal/contribute": "^5.0@beta",
"drupal/ctools": "^3.2",
"drupal/entity_reference_revisions": "^1.6",
"drupal/facets": "^1.3",
"drupal/field_group": "^3.0",
"drupal/form_placeholder": "^1.0",
"drupal/formblock": "^1.0@beta",
"drupal/glazed_helper": "^1.3",
"drupal/google_analytics": "^3.0",
"drupal/honeypot": "^1.29",
"drupal/imce": "^1.7",
"drupal/insert_block": "1.x-dev",
"drupal/linkit": "^4.3",
"drupal/login_emailusername": "^1.1",
"drupal/material_admin": "^1.0@alpha",
"drupal/menu_link_attributes": "^1.0",
"drupal/minifyhtml": "^1.6",
"drupal/paragraphs": "^1.6",
"drupal/pathauto": "^1.4",
"drupal/redirect": "^1.3",
"drupal/require_login": "^2.0",
"drupal/search_api": "^1.11",
"drupal/simple_sitemap": "^3.0",
"drupal/simplenews": "^1.0@alpha",
"drupal/tfa": "^1.0@alpha",
"drupal/token": "^1.5",
"drupal/video_embed_field": "^2.0",
"drupal/view_unpublished": "^1.0@alpha",
"drupal/viewport": "^1.1",
"drupal/viewsreference": "^1.4",
"drupal/workflow_state_config": "^1.0@alpha",
"drupal/xmlsitemap": "^1.0@alpha",
"drupal/allowed_formats": "^1.1",
"drupal/asset_injector": "^2.4",
"drupal/taxonomy_access_fix": "^2.6",
"drupal/text_summary_options": "^1.0",
"drupal/migrate_source_csv": "^2.2",
"drupal/migrate_plus": "^4.1",
"drupal/migrate_tools": "^4.1",
"drupal/migrate_file": "^1.1",
"drupal/entityqueue": "^1.0@alpha",
"drupal/module_missing_message_fixer": "^1.0@beta",
"drupal/rules": "^3.0@alpha",
"ckeditor/autogrow": "^4.8",
"ckeditor/codemirror": "^1.17",
"ckeditor/fakeobjects": "^4.8",
"ckeditor/image": "^4.8",
"ckeditor/link": "^4.8",
"codemirror/codemirror": "^5.36",
"jquery/geocomplete": "^1.7",
"jquery/icheck": "^1.0",
"jquery/image-picker": "^0.3.0",
"jquery/inputmask": "^3.3",
"jquery/intl-tel-input": "^12.1",
"jquery/rateit": "^1.1",
"jquery/select2": "^4.0",
"jquery/timepicker": "^1.11",
"jquery/toggles": "^4.0",
"jquery/word-and-character-counter": "^2.5",
"progress-tracker/progress-tracker": "^1.4",
"signature_pad/signature_pad": "^2.3",
"drupal/image_widget_crop": "^2.2",
"drupal/crop": "^1.5",
"drupal/better_exposed_filters": "^3.0@alpha",
"drupal/block_visibility_groups_admin": "^1.3",
"drupal/content_export_csv": "^3.0@beta",
"drupal/contentimport": "^4.1",
"drupal/event": "1.x-dev",
"drupal/entity_reference_views_select": "^1.3",
"drupal/imce_search_plugin": "^1.0",
"drupal/inline_entity_form": "^1.0@RC",
"drupal/job": "^3.0@alpha",
"drupal/media_bulk_upload": "^1.0@alpha",
"drupal/memcache": "^2.0",
"drupal/purge_ui": "^3.0@beta",
"drupal/purge_processor_lateruntime": "^3.0@beta",
"drupal/purge_tokens": "^3.0@beta",
"drupal/twig_tweak": "^2.1",
"drupal/views_bulk_operations": "^2.5",
"drupal/block_visibility_groups": "^1.3",
"drush/drush": "^9.5",
"drupal/we_megamenu": "^1.5",
"drupal/views_infinite_scroll": "^1.5",
"drupal/embed": "^1.0",
"drupal/dropzonejs": "^2.0@alpha",
"drupal/purge": "^3.0@beta",
"drupal/address": "^1.4",
"drupal/purge_purger_http": "^1.0@beta",
"drupal/smtp": "1.0-beta6",
"drupal/content_sync": "^2.1",
"drupal/console": "~1.0",
"drupal/devel": "^2.0",
"drupal/search_api_solr": "^1.2",
"drupal/bootstrap": "^3.17",
"drupal/captcha": "^1.0@beta",
"drupal/core": "^8.9"
},
$ composer update drupal/core
? Can it be that you deleted your composer.lock file? Please also read drupal/drupal deprecated. There is stated: With drupal/drupal Drupal core cannot be updated with Composer, and updates are going to be extremely difficult. You can not apply Drupal core patches with cweagans/composer-patches. Avoid this solution. You should switch to a different template instead."name": "drupal/drupal"
. Instead refactor your composer.json to look like the one from the drupal/recommended-project template. Don't delete the lock file. Of course everything installs in a different version than in the lock file when you remove it.hook_update_N()
implementations. Once Drupal does that, the database shows as installed the version Composer copied.