1、打开网址:http://www.yii2-app-advanced.dev/ ,报错目录:E:/wwwroot/yii2-app-advanced/vendor/bower/jquery/dist 不存在,如图1
2、打开 E:/wwwroot/yii2-app-advanced/vendor ,确定目录 bower 不存在,如图2
3、查看 Composer 的安装提示,发现 bower 已经被替换为 bower-asset 目录了,此处为正常,如图3
4、由于刚从 PHP 5.6.27 升级到 PHP 7.0.22,决定重新安装 Composer asset plugin,无更新,如图4
5、查看 composer.json 文件,发现 “bower-asset-library”: “vendor/bower” ,如图5
6、查看 Composer 的安装提示,bower-asset 目录下的文件从缓存加载,决定清空 Composer 缓存,如图6
7、删除 E:/wwwroot/yii2-app-advanced,重新安装,如图7
composer global require “fxp/composer-asset-plugin:^1.2.0”
composer create-project yiisoft/yii2-app-advanced yii2-app-advanced 2.0.12
8、仍然提示错误,仅删除 E:/wwwroot/yii2-app-advanced/vendor,重新安装,如图8
composer install
9、重新安装 Composer asset plugin,1.3.1 版本,如图9
composer global require “fxp/composer-asset-plugin:^1.3.1”
10、运行 composer update,报错,如图10
Problem 1
– yiisoft/yii2 2.0.9 requires bower-asset/jquery.inputmask ~3.2.2 -> no matching package found.
– yiisoft/yii2 2.0.8 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable -> no matching package
found.
– yiisoft/yii2 2.0.7 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable -> no matching package
found.
– yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
– yiisoft/yii2 2.0.12 requires bower-asset/jquery.inputmask ~3.2.2 | ~3.3.5 -> no matching package found.
– yiisoft/yii2 2.0.11.2 requires bower-asset/jquery.inputmask ~3.2.2 | ~3.3.3 -> no matching package found.
– yiisoft/yii2 2.0.11.1 requires bower-asset/jquery.inputmask ~3.2.2 | ~3.3.3 -> no matching package found.
– yiisoft/yii2 2.0.11 requires bower-asset/jquery.inputmask ~3.2.2 | ~3.3.3 -> no matching package found.
– yiisoft/yii2 2.0.10 requires bower-asset/jquery.inputmask ~3.2.2 -> no matching package found.
– yiisoft/yii2 2.0.12 requires bower-asset/jquery.inputmask ~3.2.2 | ~3.3.5 -> no matching package found.
– Installation request for yiisoft/yii2 ~2.0.6 -> satisfiable by yiisoft/yii2[2.0.10, 2.0.11, 2.0.11.1, 2.0.11.2, 2.
0.12, 2.0.6, 2.0.7, 2.0.8, 2.0.9].
Potential causes:
– A typo in the package name
– The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
11、目录 E:/wwwroot/yii2-app-advanced/vendor/bower 生成,只是目录为空,如图11
12、再次清空 Composer 缓存,执行命令:composer clear-cache,如图12
13、删除 E:/wwwroot/yii2-app-advanced,重新安装,如图13
composer global require “fxp/composer-asset-plugin:^1.3.1”
composer create-project –prefer-dist yiisoft/yii2-app-advanced yii2-app-advanced
14、打开网址:http://www.yii2-app-advanced.dev/ ,正常,如图14
15、总结:报错的原因有可能与Composer 缓存无关,而是在于 Composer asset plugin 的版本问题。
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/180644.html