在 Windows 10 64 、PHP 7.0.22 下,运行 Yii 2.0.12,提示:The file or directory to be published does not exist: E:/wwwroot/yii2-app-advanced/vendor/bower/jquery/dist 的解决

1、打开网址:http://www.yii2-app-advanced.dev/ ,报错目录:E:/wwwroot/yii2-app-advanced/vendor/bower/jquery/dist 不存在,如图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

打开 E:/wwwroot/yii2-app-advanced/vendor ,确定目录 bower 不存在

图2

3、查看 Composer 的安装提示,发现 bower 已经被替换为 bower-asset 目录了,此处为正常,如图3

查看 Composer 的安装提示,发现 bower 已经被替换为 bower-asset 目录了

图3

4、由于刚从 PHP 5.6.27 升级到 PHP 7.0.22,决定重新安装 Composer asset plugin,无更新,如图4

由于刚从 PHP 5.6.27 升级到 PHP 7.0.22,决定重新安装 Composer asset plugin,无更新

图4

5、查看 composer.json 文件,发现 “bower-asset-library”: “vendor/bower” ,如图5

查看 composer.json 文件,发现 "bower-asset-library": "vendor/bower"

图5

6、查看 Composer 的安装提示,bower-asset 目录下的文件从缓存加载,决定清空 Composer 缓存,如图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

删除 E:/wwwroot/yii2-app-advanced,重新安装

图7

8、仍然提示错误,仅删除 E:/wwwroot/yii2-app-advanced/vendor,重新安装,如图8
composer install

仍然提示错误,仅删除 E:/wwwroot/yii2-app-advanced/vendor,重新安装

图8

9、重新安装 Composer asset plugin,1.3.1 版本,如图9
composer global require “fxp/composer-asset-plugin:^1.3.1”

重新安装 Composer asset plugin,1.3.1 版本

图9

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.

运行 composer update,报错

图10

11、目录 E:/wwwroot/yii2-app-advanced/vendor/bower 生成,只是目录为空,如图11

目录 E:/wwwroot/yii2-app-advanced/vendor/bower 生成,只是目录为空

图11

12、再次清空 Composer 缓存,执行命令:composer clear-cache,如图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

删除 E:/wwwroot/yii2-app-advanced,重新安装

图13

14、打开网址:http://www.yii2-app-advanced.dev/ ,正常,如图14

打开网址:http://www.yii2-app-advanced.dev/ ,正常

图14

15、总结:报错的原因有可能与Composer 缓存无关,而是在于 Composer asset plugin 的版本问题。

 

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/250379.html

(0)
上一篇 2022年4月29日
下一篇 2022年4月29日

相关推荐

发表回复

登录后才能评论