Kévin Bibollet
Kévin Bibollet

Reputation: 3623

composer dump-autoload do nothing

I am trying to execute the command composer dump-autoload on a Laravel project, but it does nothing. It only writes Generating optimized autoload files, then stops.

I tried it on an other project, and it worked well (discovered packages, and so on).

I also tried it after updating composer (composer self-update), after checking that my composer.json is right (composer validate). Nothing changed...

The command composer update works well on the update part, but does the same when it arrives to the dump-autoload one.

Does someone have a solution?

Thanks!

Upvotes: 1

Views: 3768

Answers (1)

pablorsk
pablorsk

Reputation: 4286

Check your composer.json, pre-install-cmd and post-autoload-dump was missing.

Your scripts should look like this

{
    "scripts": {
        "pre-install-cmd": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ]
    }        
}

If the problem persists, run composer dump-autoload -vvv and check detailed errors.

Upvotes: 1

Related Questions