composer 常见问题

1. 使用composer install/update的时候会报错:
your configuration does not allow connections to http://packagist.org/packages.json. See https://getcomposer.org/doc/06-config.md#secure-http for details.

解决方法:

composer默认使用https连接,因此无法使用http连接,只需要在本地的composer.json或者全局的config.json中把默认的https禁用即可。

//全局配置修改
composer config -g secure-http false
//本地配置修改
composer config secure-http false
2.
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug

这是因为我们开启了xdebug扩展,使用该扩展的情况下,composer会变得异常耗时,这个本不是什么大问题,如果介意,可以修改/etc/php.ini或者/etc/php.d/xdebug.ini,将xdebug扩展关闭即可,别忘了重启php

3.
Warning: This development build of composer is over 60 days old. It is recommended to update it by running "/usr/local/bin/composer self-update" to get the latest version.

这是因为composer很久没有使用或者版本过低,需要更新一下自己本身的版本即可。

composer self-update
4 运行 composer self-update 时报错:
The "https://getcomposer.org/download/1.4.1/composer.phar" file could not be downloaded: Failed to enable crypto failed to open stream: operation failed

清空一下缓存(composer clear-cache)后再运行composer self-update。

5
Failed to decode response: zlib_decode(): data error 
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info

待解决

6
Could not fetch https://api.github.com/repos/jquery/jquery-dist/commits/1472290917f17af05e98007136096784f9051fab, please create a GitHub OAuth token to go over the API rate limit
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+localhost.localdomain+2017-04-23+1954
to retrieve a token. It will be stored in "/root/.composer/auth.json" for future use by Composer.
Token (hidden):

这是因为composer的真正资源保存在github上,因此对调用次数有一定限制,我们只需要登陆我们的github账号,然后点击我们的头像,选择 setting --> Personal access tokens 然后生成一个token即可,然后把生成的token填进去即可。

7
Do not run Composer as root/super user! See https://getcomposer.org/root for details

这是因为我们使用了超级管理员来操作composer,只需要换个普通用户即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值