google-api-php-client: Composer install/update: Could not delete ....

Hey there,

everytime we running composer update or composer install we have to remove the folder by hand. Anybody got an idea what the problem is?

Environment details

  • OS:
    • Host: Windows 10
    • Docker-Container: Alpine
  • PHP version: 7.1.14
  • Package name and version: google/apiclient-services v0.102

Steps to reproduce

  1. composer install or composer update

Code example

- Updating google/apiclient-services (v0.101 => v0.102):
  Update failed (Could not delete /vendor/google/apiclient-services/src/Google/Service/Compute: )
  Would you like to try reinstalling the package instead [yes]? yes
- Removing google/apiclient-services (v0.101)

[RuntimeException] Could not delete /vendor/google/apiclient-services/src/Google/Service/Compute:

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 8
  • Comments: 16 (3 by maintainers)

Most upvoted comments

I had the same issue. Weirdly, it seemed like related to permissions.

Try doing this.

chmod -R 777 vendor

And, then run composer install or composer update

I guess by default vendor has 777 permission, but still, welcome to world of PHP! 😕

What happened is it took too long (+300s) to download the library (it’s rather large). You may need to increase your composer timeout, or find a better internet connection.

Thank you. The following helped me COMPOSER_PROCESS_TIMEOUT=2000 composer install

Even though this issue has been closed, I’d thought I’d contribute.

I ran into the same issue and when I went looking for the problem I’d noticed that the PHP version set in composer.json (PHP 7.2) did not match the PHP version that was actually installed (7.4). I was able to fix it by simply setting the PHP version to the actual version and re-running require command.

Hope this helps.

I’m going to close this issue out. If you’re still having trouble, please feel free to re-open! Hopefully the solution suggested by @UnnitMetaliya works for everybody. 😃

[RuntimeException] Could not delete C:\xampp\htdocs\project\new-project/vendor/composer/a37b3b46\thephpleague-oauth1-client-1e7e6be\re sources\examples\tumblr.php: This can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed

temporary solution

# in docker
COMPOSER_PROCESS_TIMEOUT=2000 composer install

# out of docker
repeat 1000 chmod -R 0777 vendor/composer && sleep 1

I had the same issue. Weirdly, it seemed like related to permissions.

Try doing this.

chmod -R 777 vendor

And, then run composer install or composer update

I guess by default vendor has 777 permission, but still, welcome to world of PHP! 😕

chmod: cambiando los permisos de ‘vendor/EVERY-PACKAGE-ANME’: Permission denied