全局安装composer
curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer
使用阿里云镜像
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
全局加载 omposer-asset-plugin
composer global require "fxp/composer-asset-plugin:~1.4.4"
进入yii项目目录
composer update
过一会儿会提示输入TOKEN
把github对应的地址在浏览器上打开,如:https://github.com/settings/tokens/new?scopes=repo&description=xxxxxxxxxxxxx
生成token粘过来就ok了。
等待安装完成。
如果出现问题:
- yiisoft/yii2 2.0.32 requires bower-asset/inputmask ~3.2.2 | ~3.3.5 -> no matching package found. - yiisoft/yii2 2.0.32 requires bower-asset/jquery 3.4.*@stable | 3.3.*@stable | 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
先安装:
composer global require "fxp/composer-asset-plugin:~1.4.4"
如果还是不行确保你的 composer.json 文件配置或从https://github.com/yiisoft/yii2-app-basic/下份新的:
"config": { "process-timeout": 1800, "fxp-asset": { "enabled": false } }, "repositories": [ { "type": "composer", "url": "https://asset-packagist.org" } ]