yii-basic 2.14 composer安装失败 解决办法

chenhua0 2019-06-28

1.使用composer国区镜像

全局配置:
composer config -g repo.packagist composer https://packagist.phpcomposer.com

项目单独配置:
composer config repo.packagist composer https://packagist.phpcomposer.com

2.删除composer.json中默认的仓库配置

yii-basic 2.14 composer安装失败 解决办法

3.解决bower依赖

composer require yidas/yii2-bower-asset

然后我们看到依赖开始安装, composer安装失败的主要原因是默认的仓库访问很慢, 直接使用国区镜像, 需要解决bower依赖

yii-basic 2.14 composer安装失败 解决办法

4.修改bower配置: config/web.php, 将别名指向@vendor/yidas/yii2-bower-asset/bower

$config = [
    ...
    'aliases' => [
        '@bower' => '@vendor/yidas/yii2-bower-asset/bower'
    ],
    ...
];

如果没有配置密钥,需要在config/web.php中加上一个密钥

'components' => [
        'request' => [
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
            'cookieValidationKey' => 'your-key',
        ],
        ...
]

安装成功了!

yii-basic 2.14 composer安装失败 解决办法

相关推荐