gpt4 book ai didi

php - 为什么 Composer 安装突然失败?

转载 作者:行者123 更新时间:2023-12-02 17:59:00 25 4
gpt4 key购买 nike

我在运行 composer install在我的本地环境和生产环境中,它们都失败了。这是今天才开始的。我已经查看了代码更改,并且 Composer 文件没有更改。任何人都可以对此有所了解......我不知道它可能是什么。我以为 github 宕机了,但我确实成功安装了一些软件包。我收到这样的错误:

...

  • Installing phpunit/php-timer (2.1.2): Downloading (100%)
  • Installing phpunit/php-text-template (1.2.1): Downloading (100%)
  • Installing phpunit/php-file-iterator (2.0.2): Downloading (0%) Failed to download phpunit/php-file-iterator from dist: Could not authenticate against github.com Now trying to download from source
  • Installing phpunit/php-file-iterator (2.0.2): Cloning 050bedf145 from cache
  • Installing theseer/tokenizer (1.1.3): Downloading (0%) Failed to download theseer/tokenizer from dist: Could not authenticate against github.com Now trying to download from source
  • Installing theseer/tokenizer (1.1.3): Cloning 11336f6f84 from cache
  • Installing sebastian/code-unit-reverse-lookup (1.0.1): Downloading (0%) Failed to download sebastian/code-unit-reverse-lookup from dist: Could not authenticate against github.com Now trying to download from source
  • Installing sebastian/code-unit-reverse-lookup (1.0.1): Cloning 4419fcdb5e from cache
  • Installing phpunit/php-code-coverage (6.1.4): Downloading (0%) Failed to download phpunit/php-code-coverage from dist: Could not authenticate against github.com Now trying to download from source
  • Installing phpunit/php-code-coverage (6.1.4): Cloning 807e6013b0 from cache
  • Installing doctrine/instantiator (1.3.0): Downloading (0%) Failed to download doctrine/instantiator from dist: Could not authenticate against github.com Now trying to download from source
  • Installing doctrine/instantiator (1.3.0): Cloning ae466f7262 from cache
  • Installing phpspec/prophecy (v1.10.2): Downloading (0%) Failed to download phpspec/prophecy from dist: Could not authenticate against github.com Now trying to download from source
  • Installing phpspec/prophecy (v1.10.2): Cloning b4400efc9d from cache
  • Installing phar-io/version (2.0.1): Downloading (0%) Failed to download phar-io/version from dist: Could not authenticate against github.com Now trying to download from source
  • Installing phar-io/version (2.0.1): Cloning 45a2ec53a7 from cache
  • Installing phar-io/manifest (1.0.3): Downloading (0%) Failed to download phar-io/manifest from dist: Could not authenticate against github.com Now trying to download from source
  • Installing phar-io/manifest (1.0.3): Cloning 7761fcacf0 from cache
  • Installing myclabs/deep-copy (1.9.5): Downloading (0%) Failed to download myclabs/deep-copy from dist: Could not authenticate against github.com Now trying to download from source
  • Installing myclabs/deep-copy (1.9.5): Cloning b2c28789e8 from cache
  • Installing phpunit/phpunit (7.5.20): Downloading (0%) Failed to download phpunit/phpunit from dist: Could not authenticate against github.com Now trying to download from source
  • Installing phpunit/phpunit (7.5.20): Cloning 9467db479d

[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "git clone --no-checkout 'https://github.com/sebastianbergmann/phpunit.git' '/var/www/vendor/phpunit/phpunit' && cd '/var/www/vendor/phpunit/phpunit' && git remote add composer 'https://github.com/sebastianbergmann/phpunit.git' && git fetch composer && git remote set-url origin 'https://github.com/sebastianbergmann/phpunit.git' && git remote set-url composer 'https://github.com/sebastianbergmann/phpunit.git'" exceeded the timeout of 300 seconds. > install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] []...

ERROR: Service 'contianer_name' failed to build: The command '/bin/sh -c composer install && rm $(which composer)' returned a non-zero code: 1

最佳答案

我们已经看到了同样的情况,并怀疑它要么是自 1.10 以来 Composer 行为的变化,要么是 GitHub 端的速率限制的变化。
看起来它首先尝试 HTTP 下载(实际上 Composer 没有显示确切的 HTTP 错误并没有帮助),然后回退到克隆源。后者工作了一段时间,但也会导致超时,可能是因为 GitHub 也限制了这些。
无论哪种方式,为我们修复它的是确保对 GitHub 的 Composer HTTP 请求进行身份验证。请参阅此处的文档:https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens

  1. Create an OAuth token on GitHub. Read more on this.

  2. Add it to the configuration running composer config -g github-oauth.github.com <oauthtoken>

关于php - 为什么 Composer 安装突然失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60841798/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com