Laravel 未找到“Illuminate\Foundation\Application”类

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/48199082/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 17:13:59  来源:igfitidea点击:

Class 'Illuminate\Foundation\Application' not found Laravel

phplaravelcomposer-phphomestead

提问by BLDD

I installed via composer the Guzzle and i received this error,

我通过 Composer 安装了 Guzzle 并且收到了这个错误,

> @php artisan package:discover
PHP Fatal error:  Uncaught Error: Class 'Illuminate\Foundation\Application' not found in /home/vagrant/PROJ/memo/laravel_project/bootstrap/app.php:14
Stack trace:
#0 /home/vagrant/PROJ/memo/laravel_project/artisan(20): require_once()
#1 {main}
  thrown in /home/vagrant/PROJ/memo/laravel_project/bootstrap/app.php on line 14

Fatal error: Uncaught Error: Class 'Illuminate\Foundation\Application' not found in /home/vagrant/PROJ/memo/laravel_project/bootstrap/app.php:14
Stack trace:
#0 /home/vagrant/PROJ/memo/laravel_project/artisan(20): require_once()
#1 {main}
  thrown in /home/vagrant/PROJ/memo/laravel_project/bootstrap/app.php on line 14
Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255

this was working before, and now i checked the DIR path and it's all ok. I also tried composer dump-autoload, composer update, removing composer.lock and vendor, composer install

这以前有效,现在我检查了 DIR 路径,一切正常。我也尝试过 composer dump-autoload、composer update、删除 composer.lock 和 vendor、composer install

回答by Hyman

Delete vendor folder and composer.lock.

删除供应商文件夹和 composer.lock。

After that

在那之后

composer install

作曲家安装

then

然后

composer update --no-scripts

作曲家更新 --no-scripts

Try this, this will solve your error. Note:Please make sure you have all packages in composer.json.

试试这个,这将解决你的错误。 注意:请确保您在 composer.json 中拥有所有包。