Andrew Fletcher published: 6 January 2023 1 minute read
Looking at composer I first wanted to check the current version, which is actioned by running the following command
composer -V
The response I was seeing
Composer version 2.1.5 2021-07-23 10:35:47
How to update to the latest version of Composer?
Going to the Composer site, today the latest version is 2.5.1. To update my version to this I need to run
composer self-update
However, if you have the following response
[Composer\Downloader\FilesystemException]
Filesystem exception:
Composer update failed: "/usr/local/bin/composer" could not be written.
rename(/home/fdrc_drupal_dev/.cache/composer/composer-temp.phar,/usr/local/
bin/composer): Permission denied
Check the owner permissions that have been set at /usr/local/bin/composer. If root, then you will need to run the command as
sudo composer self-update
Subsequent response
Upgrading to version 2.5.1 (stable channel).
Use composer self-update --rollback to return to version 2.1.5
Finally confirming the Composer version using composer -V is giving the response
Composer version 2.5.1 2022-12-22 15:33:54
Related articles
Andrew Fletcher
•
29 Sep 2023
drush/drush[12.0.0, ..., 12.2.0] require composer-runtime-api ^2.2
Resources - changing DrushTypeVersionDrush (current)11.6.0Drush (update)12.2.0Updating Drush went OK on all testing environments until on to the staging environment. The initial error that I saw wasPHP Fatal error: Declaration of Drush\Style\DrushStyle::confirm($question, $default = true) must...
Andrew Fletcher
•
30 Aug 2023
Could not delete /var/www/html/content/vendor/composer/
Attempting to run a composer update command, you know the one used regularlycomposer updateI ran into a 'could not delete' responseLoading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Nothing to modify in lock...
Andrew Fletcher
•
28 Jul 2023
Install / uninstall modules and themes using composer
Using Composer to Manage Projects and if required their dependenciesIn this section, we're going to dive into how to use Composer to manage project dependencies. Specifically, we'll cover the following: Installing and Uninstalling packages Forcing Composer to install the...