Is it possible to update/remove/install 1 package with composer without updating everything?

I have seen a few posts answering this and saying that “composer require package” or “composer update package” will do this; but absolutely everything i do with composer attempts to update everything listed in require section of composer.json.

I thought perhaps just removing the require lines in composer.json would avoid this mess; but composer then removes these modules from my docroot.

I simply want to remove my broken (not sure why) version of drush on the server and replace it with a new one without updating core or any contrib modules.

composer remove drush/drush – but it fails the removal and then tries to update everything

xxx:~/www/d8$ composer remove drush/drush drush/drush is not required in your composer.json and has not been removed

DrupalProjectcomposerScriptHandler::checkComposerVersion Package “drush/drush” listed for update is not installed. Ignoring. Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages.

any composer command i try (rmeove, update, require) seems to want to update everything.. and then fails because of dependencies conflicts (which is good; since I don’t want anything being updated anyway).

composer.json

{     "name": "drupal-composer/drupal-project",     "description": "Project template for Drupal 8 projects with composer",     "type": "project",     "license": "GPL-2.0-or-later",     "authors": [         {             "name": "",             "role": ""         }     ],     "repositories": [         {             "type": "composer",             "url": "https://packages.drupal.org/8"         }     ],     "require": {         "php": ">=7.0.8",         "composer/installers": "^1.2",         "cweagans/composer-patches": "^1.6.5",         "drupal-composer/drupal-scaffold": "^2.5",         "drupal/address": "^1.7",         "drupal/admin_toolbar": "^1.27",         "drupal/auto_entitylabel": "^3.0@beta",         "drupal/backup_migrate": "^4.0",         "drupal/block_class": "^1.0",         "drupal/clientside_validation": "^1.2",         "drupal/coffee": "^1.0@beta",         "drupal/commerce": "2.17",         "drupal/conditional_fields": "^1.0@alpha",         "drupal/console": "^1.0.2",         "drupal/content_access": "^1.0@alpha",         "drupal/core": "^8.7.0",         "drupal/csv_serialization": "^1.4",         "drupal/ctools": "^3.2",         "drupal/date_popup": "^1.0",         "drupal/date_popup_timepicker": "^1.0@alpha",         "drupal/entity_reference_revisions": "^1.7",         "drupal/external_links_new_tab": "^1.2",         "drupal/extlink": "^1.1",         "drupal/field_group": "^1.0",         "drupal/field_permissions": "^1.0@RC",         "drupal/filefield_paths": "^1.0@beta",         "drupal/fillpdf": "4.x-dev",         "drupal/viewsreference": "^1.4",         "drush/drush": "^10.2",         "vlucas/phpdotenv": "^2.4",         "webflo/drupal-finder": "^1.0.0",         "webmozart/path-util": "^2.3",         "zaporylie/composer-drupal-optimizations": "^1.0"     },     "require-dev": {         "webflo/drupal-core-require-dev": "^8.7.0"     },     "conflict": {         "drupal/drupal": "*"     },     "minimum-stability": "dev",     "prefer-stable": true,     "config": {         "sort-packages": true     },     "autoload": {         "classmap": [             "scripts/composer/ScriptHandler.php"         ],         "files": ["load.environment.php"]     },     "scripts": {         "pre-install-cmd": [             "DrupalProject\composer\ScriptHandler::checkComposerVersion"         ],         "pre-update-cmd": [             "DrupalProject\composer\ScriptHandler::checkComposerVersion"         ],         "post-install-cmd": [             "DrupalProject\composer\ScriptHandler::createRequiredFiles"         ],         "post-update-cmd": [             "DrupalProject\composer\ScriptHandler::createRequiredFiles"         ]     },     "extra": {         "composer-exit-on-patch-failure": true,         "patchLevel": {             "drupal/core": "-p2"         },         "installer-paths": {             "web/core": ["type:drupal-core"],             "web/libraries/{$name}": ["type:drupal-library"],             "web/modules/contrib/{$name}": ["type:drupal-module"],             "web/profiles/contrib/{$name}": ["type:drupal-profile"],             "web/themes/contrib/{$name}": ["type:drupal-theme"],             "drush/Commands/contrib/{$name}": ["type:drupal-drush"]         },         "patches": {             "drupal/core": {                 "Drag-drop fix for field group config": "https://www.drupal.org/files/issues/2019-12-09/drupal-tabledrag_testing-2769825-48.patch",                 "part of above": "https://www.drupal.org/files/issues/2019-11-21/3062742_4.patch",                 "multiple terms in views issues": "https://www.drupal.org/files/issues/2019-11-14/drupal-empty_value_fix-2882076-14.patch",                 "more drag-drop fixes": "https://www.drupal.org/files/issues/2019-12-14/3089151-17-D8.patch"             },             "drupal/conditional_fields": {                 "Date field value is always empty": "https://www.drupal.org/files/issues/2020-01-19/conditional_fields-date_fields_empty-2956612-8.patch"             },             "drupal/fillpdf": {                 "Add token support for before/after text": "https://www.drupal.org/files/issues/2020-02-18/3109697-6.patch"             },             "drupal/field_group": {                 "Conditional field support": "https://www.drupal.org/files/issues/2019-12-10/field_group-support_conditional_fields-3099051-6.patch",                 "HTML5 validation broken in tabs": "https://www.drupal.org/files/issues/2019-10-04/field_group-HTML5_validation_prevents_submission_in_tabs-2969051-9.patch"             },             "drupal/serial": {                 "Feeds support": "https://www.drupal.org/files/issues/2020-02-28/serial-feeds-support-3035978-6.patch"             }         },         "drupal-scaffold": {             "initial": {                 ".editorconfig": "../.editorconfig",                 ".gitattributes": "../.gitattributes"             }         }     } } 
This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Is it possible to update/remove/install 1 package with composer without updating everything?

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.