I updated the composer with this command:
composer self-update
It was updated to version 2.0.4. Then when I tried to launch my Laravel project using:
php artisan serve
I got this error:
In PackageManifest.php line 131:
Undefined index: name
I tried getting back to the old version of the composer with this:
composer self-update --rollback
The composer was downgraded to version 1.9.3, but it didn't help with the error. Then I used this command to update the composer again:
composer self-update --stable
And still got the same error.
This is the line 131 of the PackageManifest.php file:
return [$this->format($package['name']) => $package['extra']['laravel'] ?? []];
The issue is one of the Laravel default vendor packages has a small bug. This will update the composer packages to the latest versions for your current version of laravel and this should resolve the issue.
If you want to avoid updating packages, go to vendor/composer and remove installed.json I was facing the same issue. I Saw my Laravel framework version is "laravel/framework": "6.0" So just put the cap before the version and it starts working fine. "laravel/framework": "^6.0"
Show activity on this post. It was updated to version 2.0.4. Then when I tried to launch my Laravel project using: The composer was downgraded to version 1.9.3, but it didn't help with the error. Then I used this command to update the composer again: And still got the same error.
Don't use --no-scripts. This will cause a problem, and will not create the appropiate folders which the file PackageManifest.php and others need. This is so you don't have problems with bugs in the file. vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php $packages = json_decode ($this->files->get ($path), true);
First, you should check again version after using composer self-update
. Then, you try composer update
. Finally, you run php artisan serve
.
The issue is one of the Laravel default vendor packages has a small bug.
The solution to fix this is the following:
rm -rf composer.lock
rm -rf vendor
composer install
This will update the composer packages to the latest versions for your current version of laravel and this should resolve the issue.
This was actually fixed in Laravel already, so please make sure you update Laravel to at least 6.18.7+ or 7.6.0+ or 8.0+
FYI, if you remove composer local file, it will update all your dependencies, so it's not a good idea.
By running the command composer update laravel/framework
should hopefully fix the issue and not cause any other problems. If you can not update Laravel then you better off downgrade to Composer 1 using composer self-update --1
.
If you are using illuminate/foundation
instead of laravel/framework
, then make sure you composer update illuminate/foundation
instead.
add code in Illuminate\Foundation\PackageManifest.php about to line 129:
...
$ignoreAll = in_array('*', $ignore = $this->packagesToIgnore());
// ------------------:::::::::FIX::::::::::------------
if (isset($packages['packages'])){
$packages = $packages['packages'];
}
// ---------------------------ENDFIX-------------------
$this->write(collect($packages)->mapWithKeys(function ($package) {
...
Option 1:
Open vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php
then search code :
$packages = json_decode($this->files->get($path), true);
insert
$packages = $installed['packages'] ?? $installed;
Option 2 :
run command
composer update
this helped me :
downgrade to Composer 1 using
composer self-update --1
I also faced the same issue and the following code worked for me
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With