简体   繁体   中英

PHP laravel error when running any php artisan command

EDIT: So I am trying to use a laravel project that I already used before, whenever i use

php artisan migrate

I immediately get:

PHP Fatal error:  Uncaught exception 'ReflectionException' with message 'Class HelloVideo\Console\Kernel does not exist' in /var/www/html/orange/php/application/vendor/laravel/framework/src/Illuminate/Container/Container.php:776

And afterward, whenever I use any php artisan the same error keeps showing up..

Composer.json:

{
        "name": "laravel/laravel",
        "description": "The Laravel Framework.",
        "keywords": ["framework", "laravel"],
        "license": "MIT",
        "type": "project",
        "require": {
                "laravel/framework": "5.0.*"
        },
        "require-dev": {
                "phpunit/phpunit": "~4.0",
                "phpspec/phpspec": "~2.1"
        },
        "autoload": {
                "classmap": [
                        "database"
                ],
                "psr-4": {
                        "App\\": "app/"
                }
        },
        "autoload-dev": {
                "classmap": [
                        "tests/TestCase.php"
                ]
        },
        "scripts": {
                "post-install-cmd": [
                        "php artisan clear-compiled",
                        "php artisan optimize"
                ],
                "pre-update-cmd": [
                        "php artisan clear-compiled"
                ],
                "post-update-cmd": [
                        "php artisan optimize"
                ],
                "post-create-project-cmd": [
                        "php -r \"copy('.env.example', '.env');\"",
                        "php artisan key:generate"
                ]
        },
        "config": {
                "preferred-install": "dist"
        }
}

Do you have a app/tests/TestCase.php file on server? If not - you should remove it from composer.json (or put the file back there).

source: https://stackoverflow.com/a/24347524/14807111

Your composer.json has the following psr-4 autoloading configuration:

"psr-4": {
  "App\\": "app/"
}

However, it appears the namespace of your app is HelloVideo . Change to the following:

"psr-4": {
  "HelloVideo\\": "app/"
}

Then run composer dump-autoload .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM