Laravel8中损坏的composer.json文件
当我试图maatwebsite/excel从我的项目中删除包时,我严重损坏了一些东西。问题是我无法跟踪我所做的更改。在我maatwebsite/excel从 composer.json 中删除之前,我phpoffice/phpspreadsheet可能从 composer.json 中删除了。但我记不清了。因为当我用 git 查看旧版本时,我再也找不到这个条目了。每次我调用 Composer 时,它现在都会给出一条类似以下内容的大量错误消息。
在 ArrayLoader.php 第 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":"https://github.com/asm89/stack-cors.git","reference":"23f469e81c65e2fb7fc7bce371fbdc363fe32adf"},"dist":{"type" :"zip","url":"https://api.github.com/repos/asm89/stack-cors/zipball/23f469e81c65e2fb7fc7bce371fbdc363fe32adf","reference":"23f469e81c65e2fb37f","23f469e81c65e2fb37f"">3fesumshad7f", "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":{"Asm89Stack":"src/"}},"notification-url":"https:// packagist.org/downloads/","license":["MIT"],"authors":[{"name":"Alexander","email":"iam.asm89@gmail.com"}],"description ":"跨源资源共享库和栈中间件","主页":"https://github.com/asm89/stack-cors","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":"https://github.com/Bacon/BaconQrCode.git", "reference":"add6d9ff97336b62f95a3b94f75cea4e085465b2"},"dist":{"type":"zip","url":"https://api.github.com/repos/Bacon/BaconQrCode/zipball/add6d9ff97336bsource":{"type":"git","url":"https://github.com/Bacon/BaconQrCode.git","reference":"add6d9ff97336b62f95a3b94f75cea4e085465b2"},"dist":{"type": "zip","url":"https://api.github.com/repos/Bacon/BaconQrCode/zipball/add6d9ff97336bsource":{"type":"git","url":"https://github.com/Bacon/BaconQrCode.git","reference":"add6d9ff97336b62f95a3b94f75cea4e085465b2"},"dist":{"type": "zip","url":"https://api.github.com/repos/Bacon/BaconQrCode/zipball/add6d9ff97336b
错误消息的大小为 165K。也许,有人对我如何解决这个问题有建议?
回答
我设法通过运行解决了这个问题:
删除最近的自定义更改中的 composer.json 文件,否则检查任何现有的语法错误中的最近更改
步骤:1 删除供应商文件夹
rm -rf vendor/
步骤:2 删除composer.lock
rm composer.lock
步骤:3 composer update命令使用 composer 生成一个名为 composer.lock 的文件并更新一个名为 vendor 的文件夹
composer update
步骤:4然后使用这个命令
composer dump-autoload