composer命令遇“You are running Composer with SSL/TLS protection disabled.”错误

composer update 或 composer self-update 会遇到 “You are running Composer with SSL/TLS protection disabled.” 错误,这是因为:

composer操作的时候默认的secure-http的属性为True,只有https的链接才能被下载,默认源为packagist.org为http协议。

可以在composer.json添加配置:

"config": {
        "disable-tls": false,
        "secure-http": false
}

另外一种方法是找到 composer 的 config.json 文件配置
输入命令查找composer 的 config.json 文件 :

composer config -l -g

composer命令遇“You are running Composer with SSL/TLS protection disabled.”错误_第1张图片

找到[home]目录,打开所在文件夹可以看到 config.json 文件,把配置改为:

{
    "config": {
        "disable-tls": false,
        "secure-http": false}
}
composer命令遇“You are running Composer with SSL/TLS protection disabled.”错误_第2张图片
image.png

你可能感兴趣的:(composer命令遇“You are running Composer with SSL/TLS protection disabled.”错误)