Skip to main content

Had the situation where you are running composer however, the scripts stops with a prompt?  Such as:

- Installing composer/installers (v1.12.0): Extracting archive
composer/installers contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
Do you trust "composer/installers" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] y
  - Installing cweagans/composer-patches (1.7.2): Extracting archive
cweagans/composer-patches contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
Do you trust "cweagans/composer-patches" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] y
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
  - Installing drupal/core-composer-scaffold (9.3.12): Extracting archive
drupal/core-composer-scaffold contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
Do you trust "drupal/core-composer-scaffold" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] y
  - Installing drupal/core-project-message (9.3.12): Extracting archive
drupal/core-project-message contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
Do you trust "drupal/core-project-message" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] y
  - Installing zaporylie/composer-drupal-optimizations (1.2.0): Extracting archive
zaporylie/composer-drupal-optimizations contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
Do you trust "zaporylie/composer-drupal-optimizations" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] y

 

While this is great, and there are times this is necessary.  The inverse is true too... being times where I want to specify 'yes' from the command line so that my install doesn't require interaction.

 

Solutions

One option is to true no interaction 

composer install --no-interaction

or

composer install -n

However, this doesn't always weave it's magic.  In this situation, no interaction uses the default.  Which could be no.  So you're not in control of the script.

Is there a way to select "yes" automatically?

Yes, using the yes command

yes | composer install

 

Related articles

Andrew Fletcher29 Sep 2023
How to install PHP 8.1 on Ubuntu 20.04
Update Ubuntu 20.04To begin update the server using the commandsudo apt update && sudo apt upgrade -yFor more details about this process see How To Update All Packages Linux. PHP versionCheck the current PHP version usingphp -vThe response I had wasPHP 7.4.3 (cli) (built: Nov 2...