没有不值得去解决的问题,也没有不值得去学习的技术!

Resolve the Missing Publish Directory Error When Running Yii 2.0.12 on Windows 10 64 and PHP 7.0.22

打开网址:http://www.yii2-app-advanced.dev/ ,报错目录:E:\wwwroot\yii2-app-advanced/vendor\bower/jquery/dist 不存在

1. Open the URL: http://www.yii2-app-advanced.dev/ , and an error reports that the directory: E:\wwwroot\yii2-app-advanced/vendor\bower/jquery/dist does not exist, as shown in Figure 1

Open the URL: http://www.yii2-app-advanced.dev/ , and an error reports that the directory: E:\wwwroot\yii2-app-advanced/vendor\bower/jquery/dist does not exist
Figure 1

2. Open E:\wwwroot\yii2-app-advanced\vendor and confirm that the bower directory does not exist, as shown in Figure 2

Open E:\wwwroot\yii2-app-advanced\vendor and confirm that the bower directory does not exist
Figure 2

3. Check the Composer installation output and find that bower has already been replaced by the bower-asset directory; this is normal, as shown in Figure 3

Check the Composer installation output and find that bower has already been replaced by the bower-asset directory
Figure 3

4. Since I had just upgraded from PHP 5.6.27 to PHP 7.0.22, I decided to reinstall the Composer asset plugin, but there was no update, as shown in Figure 4

Since I had just upgraded from PHP 5.6.27 to PHP 7.0.22, I decided to reinstall the Composer asset plugin, but there was no update
Figure 4

5. Check the composer.json file and find “bower-asset-library”: “vendor/bower”, as shown in Figure 5

Check the composer.json file and find "bower-asset-library": "vendor/bower"
Figure 5

6. Check the Composer installation output; the files in the bower-asset directory are loaded from the cache, so I decide to clear the Composer cache, as shown in Figure 6

Check the Composer installation output; the files in the bower-asset directory are loaded from the cache, so I decide to clear the Composer cache
Figure 6

7. Delete E:\wwwroot\yii2-app-advanced and reinstall, as shown in Figure 7
composer global require “fxp/composer-asset-plugin:^1.2.0”
composer create-project yiisoft/yii2-app-advanced yii2-app-advanced 2.0.12

Delete E:\wwwroot\yii2-app-advanced and reinstall
Figure 7

8. The error still occurs, so I only delete E:\wwwroot\yii2-app-advanced\vendor and reinstall, as shown in Figure 8
composer install

The error still occurs, so I only delete E:\wwwroot\yii2-app-advanced\vendor and reinstall
Figure 8

9. Reinstall the Composer asset plugin, version 1.3.1, as shown in Figure 9
composer global require “fxp/composer-asset-plugin:^1.3.1”

Reinstall the Composer asset plugin, version 1.3.1
Figure 9

10. Run composer update, and an error occurs, as shown in Figure 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.

Run composer update, and an error occurs
Figure 10

11. The directory E:\wwwroot\yii2-app-advanced\vendor\bower is generated, but the directory is empty, as shown in Figure 11

The directory E:\wwwroot\yii2-app-advanced\vendor\bower is generated, but the directory is empty
Figure 11

12. Clear the Composer cache again by running the command: composer clear-cache, as shown in Figure 12

Clear the Composer cache again by running the command: composer clear-cache
Figure 12

13. Delete E:\wwwroot\yii2-app-advanced and reinstall, as shown in Figure 13
composer global require “fxp/composer-asset-plugin:^1.3.1”
composer create-project –prefer-dist yiisoft/yii2-app-advanced yii2-app-advanced

Delete E:\wwwroot\yii2-app-advanced and reinstall
Figure 13

14. Open the URL: http://www.yii2-app-advanced.dev/ , and it works normally, as shown in Figure 14

Open the URL: http://www.yii2-app-advanced.dev/ , and it works normally
Figure 14

15. Conclusion: The cause of the error might not be related to the Composer cache, but rather to the version of the Composer asset plugin.

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系