Andrew Fletcher published: 9 May 2022 2 minutes read
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-interactionor
composer install -nHowever, 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