I am using Composer for my PHP project. I am new to Composer. Now when I update my dependencies using composer update
command, it is saying that my Composer version is too old and ask me to update. So I tried as below. But all failed.
My composer.phar
file is in C:/ProgramData/ComposerSetup/bin/composer.phar
I opened terminal and tried
composer.phar update
php composer.phar update
composer C:/ProgramData/ComposerSetup/bin/composer.phar update
php composer C:/ProgramData/ComposerSetup/bin/composer.phar update
When I run composer-self-update
, error as in screenshot.
All command failed. I am using XAMPP. There is no composer.phar
file in xampp/php
folder as well. How can I update Composer in Windows 10?
Try
composer self-update
If this doesn't work check your PATH variable, if it's not there try searching composer.bat in windows and add it to your PATH variable. Normally, its in following path.
C:\\ProgramData\\ComposerSetup\\bin
Windows 10 update for Composer still works (end of 2020, pre version 2) with:
composer self-update --1
it will be updated from 1.x
composer self-update --2
it will be updated from 2.x and from 1.x
composer self-update --rollback
If you need to rollback to your previous version
composer -V
For check your composer version
composer self-update:
If you run composer self-update
from 1.x, it will warn you that a new stable major version of Composer is available, and you can use composer self-update --2
to migrate to it.
So run composer self-update --2
How easy is it to upgrade?
Windows 10 update for Composer still works (end of 2020, pre version 2) with:
composer self-update
If you need to rollback to your previous version, you can do that with:
composer self-update --rollback
Try.
php composer.phar self-update
'update' updates your dependencies not composer itself.
Use
composer self-update --2
By default, the installer and composer self-update
will download the latest stable version only. To programmatically install specific major versions you can use the --1
or --2
flag.
To go back to the previous version:
composer self-update --rollback
To check the current version
composer --version
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.