Composer 在 TFS 服务器上安装失败

Composer install fail on TFS Server

我们正在 运行 部署 Team Foundation Server(本地),作为构建过程的一部分,它 运行 由其作曲家安装依赖项。在上周的某个时候,这个过程开始失败,我不知道为什么。

这是失败 运行 的控制台输出:

- Installing symfony/polyfill-ctype (v1.11.0): Downloading (connecting...)Downloading (failed) 
Downloading (connecting...)Downloading (failed) 
Downloading (connecting...)Downloading (failed)  Failed to download symfony/polyfill-ctype from dist: The "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a" file could not be downloaded: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Now trying to download from source
- Installing symfony/polyfill-ctype (v1.11.0): Cloning 82ebae0220


[RuntimeException]
Failed to clone https://github.com/symfony/polyfill-ctype.git via https, ss
h protocols, aborting.

- https://github.com/symfony/polyfill-ctype.git
Cloning into 'D:\agent\_work\s\vendor\symfony\polyfill-ctype'...
fatal: unable to access 'https://github.com/symfony/polyfill-ctype.git/':
Failed to connect to github.com port 443: Timed out

- git@github.com:symfony/polyfill-ctype.git
Cloning into 'D:\agent\_work\s\vendor\symfony\polyfill-ctype'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

这是大约一个月前成功 运行 的部分输出:

2021-03-25T09:46:09.0972736Z Package operations: 28 installs, 0 updates, 0 removals
2021-03-25T09:46:09.0972880Z - Installing symfony/polyfill-ctype (v1.11.0): Loading from cache
2021-03-25T09:46:09.2716787Z - Installing webmozart/assert (1.4.0): Loading from cache
2021-03-25T09:46:09.5064411Z - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
2021-03-25T09:46:09.7547542Z - Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
2021-03-25T09:46:10.0682007Z - Installing phpdocumentor/reflection-docblock (4.3.1): Loading from cache
2021-03-25T09:46:10.4608228Z - Installing phpunit/php-token-stream (3.0.1): Loading from cache

成功的 运行 表明它是“从缓存中加载”而不是 github。我对作曲家没有那么丰富的经验,所以我不确定出了什么问题。据我所知,我们的 TFS 系统上的任何设置都没有更改。

此 运行 无法访问 github 的服务器,因为它位于阻止它的防火墙和代理之后。但一直都是这样。

有谁知道为什么 composer 以前一直在使用缓存,现在正在尝试访问 github?

我已经在互联网上搜索了数小时以了解作曲家缓存的工作原理,但未能找到任何有用的信息。

非常感谢您的帮助。

  1. 将变量 system.debug 设置为 true 以检查日志以查看是否可以获得更多信息。

  2. 您的代理计算机上的作曲家缓存似乎最近被删除了。您可以让您的代理机器访问互联网,或者在代理机器上手动安装软件包。

我终于解决了这个问题,方法是更新我们的公司代理以允许我们的构建服务器访问 github。

我仍然不知道构建是如何运行这么长时间而没有问题的,因为据我所知,构建服务器至少在去年是不允许访问 github 的。我只能假设有人手动设置了 Composer 缓存,或者服务器可以在某个时间访问 github 然后缓存持续了很长时间。

这是那些令人困惑的问题之一,似乎没有任何改变来解释它。但是我认为很久以前一定发生了一些变化,缓存正在掩盖它。

感谢所有帮助过的人。