我在 docker 容器中使用 composer install 构建了我的 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 ...
关于docker - file_put_contents(/root/.composer/cache/repo/https---flex.symfony.com/) : failed to open stream: Is a directory error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68632437/