在TFS服务器上安装Composer失败



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

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

- 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_work3svendorsymfonypolyfill-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_work3svendorsymfonypolyfill-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. 您的代理计算机上的composer缓存最近似乎已删除。您可以让代理计算机访问互联网,也可以在代理计算机上手动安装程序包。

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

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

这是一个令人困惑的问题,似乎没有任何变化来解释它。然而,我认为一定是很久以前发生了什么变化,缓存正在屏蔽它。

感谢所有提供帮助的人。

最新更新