jeremias rosas
jeremias rosas

Reputation: 53

Error [RuntimeException] Could not scan for classes inside "database/seeds"

I have a problem running composer update

the same thing happens with other installation commands too

Error:

[RuntimeException] Could not scan for classes inside "database/seeds" which does not appear to be a file nor a folder

How can I solve this error? try, running composer install and it doesn't work either

{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
    "framework",
    "laravel"
],
"license": "MIT",
"require": {
    "php": "^7.2.5",
    "fideloper/proxy": "^4.2",
    "fruitcake/laravel-cors": "^1.0",
    "guzzlehttp/guzzle": "^6.3",
    "laravel/framework": "^7.0",
    "laravel/tinker": "^2.0",
    "laravel/ui": "^2.0"
},
"require-dev": {
    "facade/ignition": "^2.0",
    "fzaninotto/faker": "^1.9.1",
    "mockery/mockery": "^1.3.1",
    "nunomaduro/collision": "^4.1",
    "phpunit/phpunit": "^8.5"
},
"config": {
    "optimize-autoloader": true,
    "preferred-install": "dist",
    "sort-packages": true
},
"extra": {
    "laravel": {
        "dont-discover": []
    }
},
"autoload": {
    "psr-4": {
        "App\\": "app/"
    },
    "classmap": [
        "database/seeds",
        "database/factories"
    ]
},
"autoload-dev": {
    "psr-4": {
        "Tests\\": "tests/"
    }
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
    "post-autoload-dump": [
        "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
        "@php artisan package:discover --ansi"
    ],
    "post-root-package-install": [
        "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
        "@php artisan key:generate --ansi"
    ]
}
}

Upvotes: 3

Views: 13152

Answers (3)

sydadder
sydadder

Reputation: 483

For those encountering issues with Docker integration, the error message indicating a missing "database" directory on the container suggests that the necessary files or directories are not being copied over correctly during the Docker image build process.

To resolve this issue, ensure that your Dockerfile includes the necessary commands to copy the entire project directory into the container. Here's how you can modify your Dockerfile to include the "database" directory:

COPY ./<document/root/> /<your/app/path>

In my case it was

COPY . /var/www/

Upvotes: 0

Amit Shah
Amit Shah

Reputation: 8179

In my case I changed "database/seeds" to "database/seeders" under composer.json > autoload > classmap and SOLVED the issue.

"autoload": {
    "psr-4": {
        "App\\": "app/"
    },
    "classmap": [
        "database/seeders",
        "database/factories"
    ]
},

Upvotes: 2

Mohammad.Kaab
Mohammad.Kaab

Reputation: 1105

Change composer autoload to

"autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    }

In Laravel 8 two directories Factory and seeders have Namespace. While in Laravel 7 it's still using the class-map to load them.

First, check your classes if they are using namespace then use psr4 autoload otherwise you can use class-map;

Upvotes: 10

Related Questions