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

1

8

I build my symfony 4 application with composer install inside docker container.

Composer version 1.10.19

But i got this error.

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

If i run composer install 1 more time without any interruption build is succeeded.

If i delete vendor and var/cache directory on project directory error accoured again.

I tried this methods:

  • trigger 'composer clearcache' command no success
  • Delete ~/.composer directory no success
  • chmod -R 777 ~/.composer no success

Some build of the same project inside different container is succeeded. My container starts with this volumes:

  • project directory

  • ~/.ssh directory

I search across net but got no solution. PLease help.

Spodumene answered 3/8, 2021 at 8:7 Comment(4)
rm -rf /root/.composer/cache/repo/https---flex.symfony.com && touch /root/.composer/cache/repo/https---flex.symfony.com worked but is there any other solutionSpodumene
I hope solution is differen from composer update. Because symfony gives not enough memory error and i cant increase this memory limit.Spodumene
can't you increase it by using COMPOSER_MEMORY_LIMIT=-1 composer update ?Bunion
Make your composer install without cache : composer install --no-cache ... Or if you can update flex, it will solve the problem according to Symfony's creator : github.com/symfony/flex/issues/780Kibitka
B
3

This was a bug on Flex version <1.13.4

In latest version (as I write 1.13.4) the issue is solved.

The problem was:

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.

That problem was solved with commit d81196c3f3b5

Edit: as posted by @Tmb a workaround is to use: composer install --no-cache ...

Benedetta answered 3/8, 2021 at 9:9 Comment(1)
had the same issue, clearing the composer cache worked for me.Complex

© 2022 - 2024 — McMap. All rights reserved.