如何更正composer的[Composer \ Downloader \ TransportException]错误 [英] How to correct the [Composer\Downloader\TransportException] error for composer

查看:449
本文介绍了如何更正composer的[Composer \ Downloader \ TransportException]错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天来我一直遇到这个问题,当我尝试使用作曲家为我的PHP项目下载依赖项时出现此错误

I have been having this problem for days now, when I try to download dependencies for my PHP project using composer I get this error

c:\wamp64\www\Test>composer global require "fxp/composer-asset-plugin:^1.3.1"
Changed current directory to C:/Users/Nwachukwu Favour/AppData/Roaming/Composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)

Installation failed, reverting ./composer.json to its original content.


  [Composer\Downloader\TransportException]
  The "http://packagist.org/p/provider-2014%241cf88bd0ed4076dc091407477ba2a76483e8598ee5365673381262e6c1d40fcf.jso
  n" file could not be downloaded: failed to open stream: HTTP request failed!


require [--dev] [--prefer-source] [--prefer-dist] [--no-plugins] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--] [<packages>]...

我正在运行Windows 10操作系统,怀疑我的系统无法从命令行下载.如果有人可以帮助我解决这个问题,我将感到非常高兴,因为它阻碍了我的项目.

I am running a Windows 10 OS and am suspecting that my system cannot download from the command line. I would be very glad if someone can help me solve this problem because it is hindering my project.

推荐答案

您还可以在安装任何依赖项之前在CLI上运行此命令.它迫使作曲家使用https下载所有资源:

You could also run this command on the CLI before installing any dependencies. It forces composer to use https to download all resources:

composer config -g repo.packagist composer https://packagist.org

这篇关于如何更正composer的[Composer \ Downloader \ TransportException]错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆