Rumah  >  Artikel  >  rangka kerja php  >  composer安装yii失败怎么办

composer安装yii失败怎么办

王林
王林asal
2020-02-20 14:16:192876semak imbas

composer安装yii失败怎么办

1、使用composer国区镜像

全局配置:

composer config -g repo.packagist composer https://packagist.phpcomposer.com

项目单独配置:

composer config repo.packagist composer https://packagist.phpcomposer.com

推荐教程:yii框架

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

378cabf508d8657609df3a904735b5c.png

3、解决bower依赖

composer require yidas/yii2-bower-asset

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

215bb4c2be99fbddd2b497d7ab60d8d.png

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

68f0ccf864ec35f8f9c4b5c393f2fa7.png

如果没有配置密钥,需要在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',
        ],
        ...
]

更多编程相关内容,请关注php中文网编程入门栏目!

Atas ialah kandungan terperinci composer安装yii失败怎么办. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn