为什么composer配置了国内镜像,还是很慢

by pxz


发布于: 2018-08-18 所属分类: php 标签: composer  1141


<p>执行 <code>php composer.phar require mdmsoft/yii2-admin "~2.0"</code> 很慢</p> <p>使用了全局的配置方式<br><code>composer config -g repo.packagist composer https://packagist.phpcomposer.com</code><br>然后执行 <code>php composer.phar require mdmsoft/yii2-admin "~2.0"</code> 还是很慢, </p> <p>尝试运行了单个项目的配置命令<br><code>composer config repo.packagist composer https://packagist.phpcomposer.com</code><br>然后执行 <code>php composer.phar require mdmsoft/yii2-admin "~2.0"</code> 还是很慢, </p> <p>后面我加了 -vvv 显示调试详细信息</p> <pre><code>$ php composer.phar require mdmsoft/yii2-admin "~2.0" -vvv Reading ./composer.json Loading config file C:/Users/wego/AppData/Roaming/Composer/config.json Loading config file C:/Users/wego/AppData/Roaming/Composer/auth.json Loading config file ./composer.json Checked CA file C:\Users\wego\AppData\Local\Temp\ope9BD8.tmp: valid Executing command (D:\www\yiiblog): git branch --no-color --no-abbrev -v Reading C:/Users/wego/AppData/Roaming/Composer/composer.json Loading config file C:/Users/wego/AppData/Roaming/Composer/config.json Loading config file C:/Users/wego/AppData/Roaming/Composer/auth.json Loading config file C:/Users/wego/AppData/Roaming/Composer/composer.json Loading config file C:\Users\wego\AppData\Roaming\Composer/auth.json Reading C:\Users\wego\AppData\Roaming\Composer/auth.json Reading D:\www\yiiblog/vendor/composer/installed.json Loading plugin yii\composer\Plugin Running 1.6.5 (2018-05-04 11:44:59) with PHP 5.6.35 on Windows NT / 10.0 Downloading https://asset-packagist.org/packages.json ... ... ` </code></pre><p>从 <code>Downloading https://asset-packagist.org/packages.json</code> 可以看出, 它还在使用国外的境像地址</p> <p>后面检查 项目的 composer.json, 发现了 repositories 是这样的, 还有一个0的是 <a href="https://asset-packagist.org">https://asset-packagist.org</a></p> <pre><code> "repositories": { "0": { "type": "composer", "url": "https://asset-packagist.org" }, "packagist": { "type": "composer", "url": "https://packagist.phpcomposer.com" } } </code></pre><p>于是我把它删掉, 再执行 <code>php composer.phar require mdmsoft/yii2-admin "~2.0"</code> 速度就正常了</p>

发表评论

暂无评论

搜索
用户登陆