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

标签 docker symfony composer-php symfony-flex

我在 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 目录,则会再次出现错误。
我试过这个方法:
  • 触发'composer clearcache'命令没有成功
  • 删除 ~/.composer 目录没有成功
  • chmod -R 777 ~/.composer 没有成功

  • 在不同容器内构建相同项目的一些成功。我的容器以此卷开头:
  • 项目目录
  • ~/.ssh 目录

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

    最佳答案

    这是 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/

    相关文章:

    docker - 部署到多个生产服务器

    postgresql - docker容器中的Pyspark postgresql数据库连接

    docker - 使用nginx代理容器(如前端服务器)访问同一主机上的多个容器时出现错误503

    forms - symfony2 带有参数的表单查询构建器

    php - 如何在 symfony2 中设置主键变量

    php - Uncaught Error : Class 'MyApp\Chat' not found

    ruby-on-rails - 从 Docker Hub 拉取 dockerized rails 应用程序时无法启动它

    php - 在 Symfony2 中组织可重用 DBAL 查询的最佳实践?

    php - composer.json 中的 dev-master,这是疯了吗?

    php - Composer 没有将依赖项安装到 PHP 项目中