composer需要[package]结果[Composer \ Downloader \ TransportException] Content-Length不匹配

时间:2017-04-09 00:08:40

标签: php composer-php

我正在尝试运行composer require laravel/passport=~1.0,但每次都会导致以下错误:

composer require laravel/passport=~1.0
./composer.json has been updated
Loading composer repositories with package information

The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Operation timed out
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info
The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Operation timed out
https://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
Updating dependencies (including require-dev)

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


  [Composer\Downloader\TransportException]
  Content-Length mismatch


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

关注this thread我尝试将其添加到composer.json

的底部
"config": {
    "github-protocols": [
      "https"
    ]
  },
  "repositories": {
    "packagist": {
      "type": "composer",
      "url": "https://packagist.org"
    }
  }

但仍然得到同样的错误。我不是终端或作曲家的专家,但这种情况突然发生,我不认为我做了任何不同的事情会导致这个问题。以前在安装其他软件包时没有问题。

0 个答案:

没有答案