问题
I'm just trying to deploy my application and I just ran composer update on my server and I got the following error:
In PackageManifest.php line 122:
Undefined index: name
How can I fix this issue?
回答1:
i had the same problem.
In my case downgrading the composer version fixed the problem.
They updated Composer 4 times within 2 days - i think they had a problem with their newest updates.
In my case version 1.10.1 was the version to go with.
I hope it'll work.
回答2:
Try this, it is worked for me, in following file:
vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php
Find this line and comment it
$packages = json_decode($this->files->get($path), true);
Add two new lines after above commented line
$installed = json_decode($this->files->get($path), true);
$packages = $installed['packages'] ?? $installed;
回答3:
I found this issue on the composer git-hub server that helped a lot:
https://github.com/composer/composer/issues/9340
I updated my Laravel framework from 5.8 to 5.8.38, following the table displayed in that issue and the error disappeared.
This blog also helps: https://blog.laravel.com/upgrading-to-composer-v2
If you can't upgrade Laravel, you can just stay with Composer 1 by running composer self-update --1
回答4:
I had a problem like this, and also tried composer self-update --stable, but there was no result. So, I found that this file belongs to the Laravel framework. So the following command resolved this issue:
$ composer update laravel/framework
回答5:
Running the following command fixed it for us
composer self-update --stable
回答6:
In my case downgrading the composer version fixed the problem.
sudo composer self-update --1
来源:https://stackoverflow.com/questions/61177995/laravel-packagemanifest-php-undefined-index-name