yiisoft/yii2 2.0.15.1 requires bower-asset/inputmask ~3.2.2 | ~3.3.5 -> no matching package found.

当我尝试使用 composer 工具给 Yii2 项目升级依赖包的时候,总是抛出如下提示:

Your requirements could not be resolved to an installable set of packages.

Problem 1
– yiisoft/yii2 2.0.15.1 requires bower-asset/inputmask ~3.2.2 | ~3.3.5 -> no matching package found.
– yiisoft/yii2 2.0.16.1 requires bower-asset/inputmask ~3.2.2 | ~3.3.5 -> no matching package found.
– yiisoft/yii2 2.0.16 requires bower-asset/inputmask ~3.2.2 | ~3.3.5 -> no m atching package found.
– yiisoft/yii2 2.0.15.1 requires bower-asset/inputmask ~3.2.2 | ~3.3.5 -> no matching package found.

这个提示如此烦人,Google了一圈,有说修改Yii2里面的composer.json文件的,有说用fxp设置的,试过,都不起作用。

最终的解决方法,是在引入Yii2 包之前,引入下面这个包,原理是提前把依赖包给提供了。

经过实践检测有效。包地址:https://packagist.org/packages/maiscrm/yii2-composer-bower-skip

"require": {
    "php": ">=5.4.0",
    "yidas/yii2-composer-bower-skip": "~2.0.5",
    "yiisoft/yii2": "~2.0.5",
    "yiisoft/yii2-bootstrap": "~2.0.0"
}