添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
紧张的柠檬  ·  Visual ...·  1 年前    · 
挂过科的企鹅  ·  flutter ...·  2 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am getting following error when I open my site which is made using laravel 5

Fatal error: Class 'Illuminate\Foundation\Application' not found in C:\cms\bootstrap\app.php on line 14

I have tried removing vendor folder and composer.lock file and running composer install it's not working I tried running PHP artisan optimize but it shows error

Fatal error: Class'Illuminate\Foundation\Application' not found

Is there any way to solve this problem?

Edited: This problem aroused as soon as I used the php artisan make:model Page command which did create the model but then the above error gets displayed when I access the site Also If use the Laravel's Local Development Server no such problem arises only if I use wamp server

php artisan clear-compiled shows the same error Iluminate\Foundation\Appication not found xenish Apr 21, 2015 at 8:51

In my situation, I didn't have the full vendor dependencies in place (composer file was messed up during original install) - so running any artisan commands caused a failure.

I was able to use the --no-scripts flag to prevent artisan from executing before it was included. Once my dependencies were in place, everything worked as expected.

composer update --no-scripts
                +1 Worked for me. In my case I have included other required packages separately in the composer.json file. This helped me.
– Jnanaranjan
                Jul 17, 2015 at 13:15
                Also worked for me using "composer update --no-scripts" (after running "composer dump-autoload")
– Kevin Pajak
                Jul 10, 2018 at 5:42

Just in case I trip over this error in 2 weeks again... My case: Checkout an existing project via git and pull in all dependencies via composer. Came down to the same error listed within the title of this post.

Solution:

composer dump-autoload
composer install --no-scripts

make sure everything works now as expected (no errors!)

composer update
                This should be the accepted answer, was going around this for about two hours, trying other answers from stack, but this totally solved it. Easy and to the point. Thanks
– Migerusantte
                Oct 31, 2017 at 2:40
                This works for me, encounter this issues after migrating Laravel website to another server
– Adolfo Gomez Nasol
                Sep 6, 2018 at 6:52
                in my case ," composer dump-autoload" didn't worked but instead "composer install --no-scripts" was so fine!
– Ali Safaei
                Mar 8 at 12:18

Something is clearly corrupt in your Laravel setup and it is very hard to track without more info about your environment. Usually these 2 commands help you resolve such issues

php artisan clear-compiled
composer dump-autoload

If nothing else helps then I recommend you to install fresh Laravel 5 app and copy your application logic over, it should take around 15 min or so.

I just fixed this problem (Different Case with same error),
The answer above I tried may not work because My case were different but produced the same error.
I think my vendor libraries were jumbled,
I get this error by:
1. Pull from remote git, master branch is codeigniter then I do composer update on master branch, I wanted to work on laravel branch then I checkout and do composer update so I get the error,

Fatal error: Class 'Illuminate\Foundation\Application' not found in C:\cms\bootstrap\app.php on line 14

Solution: I delete the project on local and do a clone again, after that I checkout to my laravel file work's branch and do composer update then it is fixed.

For latest laravel version also check your version because I was also facing this error but after update latest php version, I got rid from this error.

Your answer must have an interpretive example along with your code, after all this question is old ... – Paulo Boaventura May 29, 2021 at 4:57

please test below solution:

  • first open command prompt cmd ==> window+r and go to the location where laravel installed.

  • try composer require laravel/laravel

    i was having same problem with this error. It turn out my Kenel.php is having a wrong syntax when i try to comply with wrong php8 syntax

    The line should be

    protected $commands = [
    

    instead of

    protected array $commands = [
    
  •