Home > Software design >  PHP laravel error when running any php artisan command
PHP laravel error when running any php artisan command

Time:11-29

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"
        }
}

CodePudding user response:

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.

CodePudding user response:

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

  • Related