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 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...
Andrew Fletcher20 Feb 2025
Handling duplicate records in Drupal
Duplicate records in Drupal can cause significant issues, particularly when they lead to integrity constraint violations in the database. These errors often occur due to duplicate UUIDs in the `node` table, which can result from programmatic imports, migrations, or unintended database...
Andrew Fletcher17 Feb 2025
The overlooked challenge of migration updates in Drupal projects
When working on Drupal migrations, developers often assume that adding a new field to the process section will seamlessly update existing content. However, unless explicitly handled, Drupal’s migration system does not automatically apply changes to previously migrated records. This oversight can...