Purge bower-asset from a Yii 2 project

I don’t know what’s the problem with this, but it keeps being a pain in the butt when working with composer. We have a Yii 2 project that does not face the web. Would it be possible to completely remove anything bower related? How?

Tried so far

  • rm -rf vendor/
  • Remove composer.lock
  • Remove any mention of bower-asset in composer.json

Still getting crap like:

- yiisoft/yii2 2.0.47 requires bower-asset/jquery 3.6.*@stable | 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 -> no matching package found.

Why would I need jQuery in a non-web project?


Possibly this package helps:


Yeah. Since Yii2 is fullstack framework, it installs many things some of which may be unused in the end. It is not a good idea to change Yii2 now and the problem is solved in Yii3.

1 Like

What problem does it pose if you just leave those “garbages”?

composer behaves very very weirdly when they are in the mix, but installing yidas/yii2-composer-bower-skip fixed it.

1 Like

Hmmm still getting

Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of
type string is deprecated in .config/composer/vendor/fxp/composer-asset-plugin/Converter/SemverUtil.php:148


Oh, this was a vendor folder in my user home folder that needed to be removed.

Which PHP version are you using?
fxp/composer-asset-plugin was deprecated long ago and shouldn’t be used

Well what’s the alternative?

Using PHP 8 or something, composer 1.

Yes, use PHP8.2. 8.1 is already in maintenance mode and Yii2 supports 8.2 without issues