Laravel失败并显示错误消息:致命错误:未捕获的ReflectionException:类App \ Http \ Kernel不存在

时间:2019-04-23 13:36:55

标签: laravel composer-php

我认为我犯了一个错误,但是不幸的是,现在我的Laravel网站无法正确构建了。

我不确定在哪里可以找到解决此问题的方法。有人可以指出我正确的方向吗?

root@f506ece6f4ea:/var/www/html# php public/index.php

Fatal error: Uncaught ReflectionException: Class App\Http\Kernel does not exist in /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:790
Stack trace:
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(790): ReflectionClass->__construct('App\\Http\\Kernel')
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(667): Illuminate\Container\Container->build('App\\Http\\Kernel')
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(265): Illuminate\Container\Container->resolve('App\\Http\\Kernel', Array, false)
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(787): Illuminate\Container\Container->Illuminate\Container\{closure}(Object(Illuminate\Foundation\Application), Array)
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(667): Illuminate\Container\Container->build(Object(Closure))
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Conta in /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 790
root@f506ece6f4ea:/var/www/html# ls -al app/Http/
total 20
drwxr-xr-x 4 root root 4096 Feb 28 20:31 .
drwxr-xr-x 6 root root 4096 Feb 28 20:31 ..
drwxr-xr-x 3 root root 4096 Feb 28 20:31 Controllers
-rw-r--r-- 1 root root 2823 Feb 28 20:31 Kernel.php
drwxr-xr-x 2 root root 4096 Feb 28 20:31 Middleware
root@f506ece6f4ea:/var/www/html# cat composer.json
{
    "name": "dennis00/laravel-example",
    "description": "Example of Laravel Distro",
    "type": "project",
    "license": "GPL-2.0+",
    "minimum-stability": "dev",
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "require": {
        "dennis00/laravel-distro": "dev-master@dev",
        "laravel/horizon": "^4.0@dev"
    }
}
root@f506ece6f4ea:/var/www/html# ls vendor
autoload.php  cakephp dennis00  doctrine   egulias  fideloper   jakub-onderka  laravel  monolog  nette  ocramius  paragonie  phpstan  psy        ramsey     symfony   vlucas
bin       composer  dnoegel   dragonmantank  erusev   guzzlehttp  jean85       league   nesbot   nikic  opis  phpoption  psr      ralouphie  swiftmailer  tijsverkoyen

1 个答案:

答案 0 :(得分:0)

您可以尝试执行以下操作

  1. 在composer.json中检查您的psr-4。应该有

      

    “自动加载”:{       “ psr-4”:{           “ App \”:“ app /”       }

  2. 删除vendor目录

  3. 运行composer update