Corrupted composer.json file in Laravel 8

When I tried to remove the package maatwebsite/excel from my project, I damaged something badly. The problem is that I can't track the changes I made. Before I removed maatwebsite/excel from composer.json, I removed phpoffice/phpspreadsheet probably from composer.json. But I can't remember exactly. Because when I check out an older version with git, I can no longer find this entry. Every time I call Composer, it now gives a considerable error message that starts like the following.

In ArrayLoader.php line 44: Unknown package has no name defined ([{"name":"asm89/stack-cors","version":"v2.0.1","version_normalized":"2.0.1.0","source":{"type":"git","url":"","reference":"23f469e81c65e2fb7fc7bce371fbdc363fe32adf"},"dist":{"type":"zip","url":"","reference":"23f469e81c65e2fb7fc7bce371fbdc363fe32adf","shasum":">"},"require":{"php":"^7.0","symfony/http->foundation":"~2.7|~3.0|~4.0|~5.0","symfony/http-kernel":"~2.7|~3.0|~4.0|~5.0"},"require-dev":{"phpunit/phpunit":"^6|^7|^8|^9","squizlabs/php_codesniffer":"^3.5"},"time":"2020-05-31T07:17:05+00:00","type":"library","extra":{"branch-alias":{"dev-master": "2.0-dev"}},"installation-source":"dist","autoload":{"psr-4":{"Asm89\Stack\":"src/"}},"notification-url":"","license":["MIT"],"authors":[{"name":" Alexander","email":"[email protected]"}],"description":"Cross-origin resource sharing library and stack middleware","homepage":"","keywords":["cors","stack"],"install-path":"../asm89/stack-cors"},{"name":"bacon/bacon-qr-code","version":"2.0.2","version_normalized":"2.0.2.0","source":{"type":"git","url":"","reference":"add6d9ff97336b62f95a3b94f75cea4e085465b2"},"dist":{"type":"zip","url":"

The error message is 165K in size. Maybe, someone has a tip for me on how to solve this problem?

2

1 Answer

I managed to solve this by running:

composer.json file in remove recent custom changes otherwise recent change in a check any existing syntax error

Step: 1 remove the vendor folder

rm -rf vendor/

step: 2 remove the composer.lock

rm composer.lock

step: 3 composer update command using composer generates a file called composer.lock and update a folder called vendor

composer update

step: 4 then use this command

 composer dump-autoload
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like