Skip to main content

Attempting to run a composer update command, you know the one used regularly

composer update

I ran into a 'could not delete' response

Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
 - Downloading drupal/core (9.5.10)
 - Upgrading drupal/core (9.5.2 => 9.5.10): Extracting archive
   Update of drupal/core failed

In Filesystem.php line 314:
                                                                                                                  
Could not delete /var/www/html/content/vendor/composer/ab878421/drupal-core-a627d1b/modules/ckeditor/tests/src:

Hopefully, all ran smoothly and you are good to go.  However, not with the response noted above.  Note on line 9, there is an error - 'Update of drupal/core failed'.  Each time the above command was run, the fail point would always change.

 

Was it a permissions issue?

The key driver of the failure, was ‘Could not delete’.  Hinting at a directory permission issue.  So initial attempts to remedy were based on permissions.  Initial attempts to resolve this error was adjusting the chmod

chmod ug+x vendor/

However, post making the above adjustment, had no impact on the error.

 

Adjusting the composer configuration time-out

Is composer timing out during the process of the update?  There are severl approaches to review time-out.

Check whether the package is being loaded from composers' cache

composer update/install -o -vvv

Yes - try clearing composer's cache or try adding

--cache-dir=/dev/null

If you want to force the download of an archive, use the --prefer-dist option in combination with --no-dev

Otherwise you could try raising composer's process timeout value:

composer config --global process-timeout 600 # default is 300

600 is denoted as seconds

 

Successful response of the command

Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
 - Downloading drupal/core (9.5.10)
 - Upgrading drupal/core (9.5.2 => 9.5.10): Extracting archive
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
Generating autoload files
Hardening vendor directory with .htaccess and web.config files.
50 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Scaffolding files for drupal/core:
 - Copy [project-root]/.editorconfig from assets/scaffold/files/editorconfig
 - Copy [project-root]/.gitattributes from assets/scaffold/files/gitattributes
 - Copy [web-root]/.csslintrc from assets/scaffold/files/csslintrc
 - Copy [web-root]/.eslintignore from assets/scaffold/files/eslintignore
 - Copy [web-root]/.htaccess from assets/scaffold/files/htaccess
 - Copy [web-root]/example.gitignore from assets/scaffold/files/example.gitignore
 - Copy [web-root]/sites/default/default.services.yml from assets/scaffold/files/default.services.yml
 - Copy [web-root]/sites/default/default.settings.php from assets/scaffold/files/default.settings.php
Cleaning installed packages.
No security vulnerability advisories found

 

 

Related articles

Andrew Fletcher04 Apr 2025
Managing .gitignore changes
When working with Git, the .gitignore file plays a critical role in controlling which files and folders are tracked by version control. Yet, many developers are unsure when changes to .gitignore take effect and how to manage files that are already being tracked. This uncertainty can lead to...
Andrew Fletcher26 Mar 2025
How to fix the ‘Undefined function t’ error in Drupal 10 or 11 code
Upgrading to Drupal 10.4+ you might have noticed a warning in their code editor stating “Undefined function ‘t’”. While Drupal’s `t()` function remains valid in procedural code, some language analysis tools — such as Intelephense — do not automatically recognise Drupal’s global functions. This...
Andrew Fletcher17 Mar 2025
Upgrading to PHP 8.4 challenges with Drupal contrib modules
The upgrade from PHP 8.3.14 to PHP 8.4.4 presents challenges for Drupal 10.4 websites, particularly when dealing with contributed modules. While Drupal core operates seamlessly, various contrib modules have not yet been updated to accommodate changes introduced in PHP 8.4.x. This has resulted in...