Composer update gives Undefined index: name
If you get an exception like running composer update
in an older Laravel-project.
In PackageManifest.php line 122:
Undefined index: name
The problem stems from that older versions of Laravel is not compatible with Composer 2.
Laravel | Composer 2 support |
---|---|
<= 5.4 | Not supported |
5.5 | 5.5.49 |
5.6 | 5.6.40 |
5.7 | 5.7.29 |
5.8 | 5.8.38 |
6.x | 6.18.7 |
7.x | 7.6.0 |
8.x | 8.0.0 |
One solution is to downgrade to Composer 1, and upgrade Laravel and then upgrade to Composer 2 again
composer self-update --1
// change composer.json to make sure the a compatible version of Laravel is used
"laravel/framework": ">=5.7.29"
composer update
// revert back to Composer 2 again.
composer self-update --2