file_put_contents(/root/.composer/cache/repo/https---flex.symfony.com/): 无法打开流:是目录错误

file_put_contents(/root/.composer/cache/repo/https---flex.symfony.com/): failed to open stream: Is a directory error

我在 docker 容器中使用 composer 安装构建我的 symfony 4 应用程序。

Composer 版本 1.10.19

但是我得到了这个错误。

[ErrorException] file_put_contents(/root/.composer/cache/repo/https---flex.symfony.com/): failed to open stream: Is a directory

如果我运行 composer install 1次没有任何中断构建成功。

如果我删除项目目录中的 vendor 和 var/cache 目录,则会再次出现错误。

我试过这个方法:

同一项目在不同容器中的部分构建成功。我的容器从这个卷开始:

我在网上搜索,但没有找到解决方案。请帮忙。

这是 Flex 版本 <1.13.4 上的错误

在最新版本中(我写的是 1.13.4)issue 已解决。

问题是:

Writing to the cache with an empty key will fail with "failed to open stream: Is a directory", so do not try to do that.

We noticed this when cloudflare - or the backend service - responded with a "last-modified" header for our CI servers (AWS) but not for our local system. This triggered the condition to become true and it tries to write a cache file without a filename.

这个问题已通过提交 d81196c3f3b5

解决

编辑:@Tmb 发布的解决方法是使用:composer install --no-cache ...