Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 472
rmznbyk 1 Avatar asked Aug 03 '21 08:08

rmznbyk 1


1 Answers

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 ...

like image 147
r3vit Avatar answered Nov 15 '22 12:11

r3vit