Problems with Composer 2 and bower asset

So, Composer updated to version 2 and broke our CI. :slight_smile: Anyone found a solution to this? Locally Iā€™m using PHP 7.4 and Composer 2.

This command:

./composer.phar require yidas/yii2-bower-asset

Fails with:

  Problem 1
    - fxp/composer-asset-plugin[v1.2.2, ..., v1.4.6] require composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
    - Root composer.json requires fxp/composer-asset-plugin ^1.2.2 -> satisfiable by fxp/composer-asset-plugin[v1.2.2, ..., v1.4.6].

You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.

Running:

./composer.phar update

fails with:

The "fxp/composer-asset-plugin" plugin was skipped because it requires a Plugin API version ("^1.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.                                                                                                                        
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - yiisoft/yii2 2.0.35 requires bower-asset/jquery 3.4.*@stable | 3.3.*@stable | 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> found bower-asset/jquery[3.5.1] but it does not match the constraint.
    - yiisoft/yii2[2.0.36, ..., 2.0.38] require bower-asset/jquery 3.5.*@stable | 3.4.*@stable | 3.3.*@stable | 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> found bower-asset/jquery[3.5.1] in lock file but not in remote repositories, make sure you avoid updating this package to keep the one from lock file.
    - Root composer.json requires yiisoft/yii2 >=2.0.35 -> satisfiable by yiisoft/yii2[2.0.35, 2.0.36, 2.0.37, 2.0.38].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Ideas?

How about switching to asset packagist like we did years ago in Yii 2 application templates?

4 Likes

The asset-plugin is not available for composer 2.0 yet.