google-api-php-client: Composer failed : Filesystem could not delete , in Docker

Environment details

  • OS: ubuntu:22.04 (Docker) using Laravel 9 with Sail
  • PHP version: 8.1
  • Package name and version: latest 2.12

Steps to reproduce

  1. composer install
  2. get the following error :
sail@769b4c6a1916:/var/www/html$ composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 1 install, 0 updates, 0 removals
  - Downloading google/apiclient-services (v0.274.0)
  - Installing google/apiclient-services (v0.274.0): Extracting archive
    Install of google/apiclient-services failed

In Filesystem.php line 314:

  Could not delete /var/www/html/vendor/composer/f9cf999e/googleapis-google-api-php-client-services-670c385/src/Contentwarehouse:

I tried to : chmod -R 777 vendor

But still … any idea ?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 15
  • Comments: 16 (2 by maintainers)

Most upvoted comments

Just a note, what worked for me, adding timeout set to 1200 in config (due to old laptop, and large size of package being extracted:

    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true,
        "process-timeout": 1200
    }

This is a Composer bug; the outcome of a function should not depend on how old (or fast) the hardware running it is. It should work the same for all team member regardless of the age of their hardware… eventually 😃

In my case, this was caused by composer process timeout. Giving it more time to complete fixed it:

COMPOSER_PROCESS_TIMEOUT=600 composer install

More info: https://koop.sh/software/fix-composer-process-timeout-issues/

I had this problem last week too and it got solved on its own on the second try. But for my colleague, it keeps failing:

- Installing google/apiclient-services failed

Could not delete /var/www/html/vendor/composer/d0d5f5a2/googleapis-google-api-php-clien
 t-services-ce77477/src/Sheets:

Version 12.3

Getting the same problem still. Interestingly enough, it only happens under Windows. Using same docker image on Ubuntu it works. Both 2.13.0 and 2.12.1 returns the same error:

`Install of google/apiclient-services failed

In Filesystem.php line 314:

Could not delete /var/www/slim_app/vendor/composer/86f7e636/googleapis-google-api-php-client-services-4b31efa/src/Directory/Resource:`

Image:

FROM php:7.4-fpm RUN apt update
&& apt install -y zlib1g-dev g++ git libicu-dev zip libzip-dev zip libpq-dev
&& docker-php-ext-install intl opcache pdo pdo_mysql
&& pecl install apcu
&& docker-php-ext-enable apcu
&& docker-php-ext-configure zip
&& docker-php-ext-install zip WORKDIR /var/www/slim_app RUN curl -sS https://getcomposer.org/installer | php – --install-dir=/usr/local/bin --filename=composer

composer.json

{ "require": { "slim/slim": "^3.10", "illuminate/database": "^5.6", "monolog/monolog": "^1.23", "awurth/slim-validation": "^3.0", "illuminate/events": "^5.6", "robmorgan/phinx": "^0.9.2", "tuupola/slim-jwt-auth": "^3.0", "firebase/php-jwt": "^5.0", "google/apiclient": "^2.13" }, "autoload": { "psr-4": { "App\\": "app/" } }, "require-dev": { "phpunit/phpunit": "7" } }

Same happens to me, but its something with docker as I figured out

if I install outside docker with --ignore-platform-reqs it works, but not inside, timing out or if I run in verbose mode to crash my Docker

 5/6 [=======================>----]  83%
    Install of google/apiclient-services failed
The following exception is caused by a process timeout
Check https://getcomposer.org/doc/06-config.md#process-timeout for details

In Process.php line 1204:

  The process "'/usr/bin/unzip' -qq '/var/www/html/vendor/composer/tmp-ac97ba793f26546f414fddb65379ccf8' -d '/var/www/html/vendor/composer/76037618'" exceeded the timeout of 300 seconds.

The workaround I did was:

  • go out of the docker, install it with --ignore-platform-reqs composer require google/apiclient --ignore-platform-reqs

  • go inside the docker, now we have the package cached and unpacked in vendor

  • remove the composer.lock and install again