安装好YII2 后出现 如下图错误提示:
解决方法如下:
打开安装好的YII2项目目录(YII2安装方法参见 摘取天上星 的博文:http://blog.csdn.net/zqtsx/article/details/39344913)
打开YII2项目目录里的 composer.json 文件 (如下图)
在composer.json 文件里添加 如下(extra括号里的部分)代码:
修改后的composer.json文件 大致如下(extra部分为我们添加的新增代码):
{ "name": "yiisoft/yii2-app-advanced", "description": "Yii 2 Advanced Application Template", "keywords": ["yii2", "framework", "advanced", "application template"], "homepage": "http://www.yiiframework.com/", "type": "project", "license": "BSD-3-Clause", "support": { "issues": "https://github.com/yiisoft/yii2/issues?state=open", "forum": "http://www.yiiframework.com/forum/", "wiki": "http://www.yiiframework.com/wiki/", "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, "minimum-stability": "dev", "require": { "php": ">=5.4.0", "yiisoft/yii2": "*", "yiisoft/yii2-bootstrap": "*", "yiisoft/yii2-swiftmailer": "*" }, "require-dev": { "yiisoft/yii2-codeception": "*", "yiisoft/yii2-debug": "*", "yiisoft/yii2-gii": "*", "yiisoft/yii2-faker": "*" }, "config": { "process-timeout": 1800 }, "extra": { "asset-installer-paths": { "npm-asset-library": "vendor/npm", "bower-asset-library": "vendor/bower", "npm-searchable": false, "bower-searchable": false } }}然后 打开命令行 切换到YII2的项目目录(非框架目录):
依次执行如下命令:
composer global require "fxp/composer-asset-plugin:1.0.*@dev"
composer update (如若不行第二步请执行“ composer update --dev --try-run ”命令,一般composer update 即可)
出现如下列图示请耐心等待 更新文件的下载即可:
到这里 更新也就结束了,
再次打开浏览器输入 项目地址 http://127.0.0.2/frontend/web/,检测项目是否恢复正常: