How to downgrade or install a specific version of Composer?
Assuming a regular composer installation, to rollback to version 1 of composer, you simply execute:
composer self-update --1
When you want to go back to version 2 (which you should, after updating or removing the incompatible plugins):
composer self-update --2
The above will take you to the latest on any of the two major versions.
You can also "update" to a specific version just by passing the version number to self-update
:
composer self-update 1.10.12composer self-update 2.0.7
And finally after performing any self-update
, you can specify --rollback
to go back to the previously installed version.
composer self-updatecomposer self-update --rollback
Finally, if you are feeling adventurous, you can update to a pre-release version by executing:
composer self-update --preview
if you have already installed composer on your system. then paste the below code to downgrade the composer version with a specific version as per your need.
composer self-update 1.10.14
for ubuntu system use the below command
sudo -H composer self-update 1.10.14
Just two commands worked for me. Currently I have composer 2.x.x , I had 1.10.x . First one command will download downgrade version and then second command will rollback to 1.x.x
- php composer self-update --1
- composer self-update --rollback