You encounter the Laravel PackageManifest.php: Undefined index: name error when Laravel tries to read the composer.json of installed packages but encounters a package that doesn’t have the expected “name” key.
How to fix the error?
Here are three approved solutions that you can use to fix the error.
- The simple fix for the error is to use this command: composer update. This will update the composer.lock file.
- If you can’t upgrade Laravel, you can just stay with Composer 1 by running this command:
composer self-update --1
- Delete the composer.lock file and Install dependencies using this command.
composer intall
If you search for the error on the internet, you will find some solutions, like downgrading the composer version or packages to be compatible with the current project, but this is a temporary solution and won’t work well in the long term.
Not recommended way to fix the error
Open this file: vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php
Find this code of line and comment on it:
$packages = json_decode($this->files->get($path), true);
Add two new lines after the above-commented line.
$installed = json_decode($this->files->get($path), true);
$packages = $installed['packages'] ?? $installed;
This will fix the error, but this is really not the recommended approach to use in your already established Laravel project.
I recommend you never change your composer version or the Laravel core files directly because if you do, third-party packages won’t be compatible with your modified version, and it will start throwing expected errors, which will cause chaos in your project.
Conclusion
The best and most efficient solution is to delete the composer.lock and install the dependencies using the “composer install” command.
Further reading
Could not open input file: artisan in Laravel
Unchecked runtime.lastError: The message port closed before a response was received
Composer is operating significantly slower curl php

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.