composer dump-autoload do nothing
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.
composer dump-autoload
Generating optimized autoload files
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...
composer self-update
composer validate
The command composer update
works well on the update part, but does the same when it arrives to the dump-autoload one.
composer update
Does someone have a solution?
Thanks!
1 Answer
1
Check your composer.json
, pre-install-cmd
and post-autoload-dump
was missing.
composer.json
pre-install-cmd
post-autoload-dump
Your scripts
should look like this
scripts
{
"scripts": {
"pre-install-cmd": [
"@php -r "file_exists('.env') || copy('.env.example', '.env');""
],
"post-autoload-dump": [
"IlluminateFoundationComposerScripts::postAutoloadDump",
"@php artisan package:discover"
]
}
}
If the problem persists, run composer dump-autoload -vvv
and check detailed errors.
composer dump-autoload -vvv
try run manually in your console
php artisan package:discover
. Also, check is you have artisan
file doing ls -la | grep artisan
– pablorsk
Jun 29 at 13:50
php artisan package:discover
artisan
ls -la | grep artisan
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
My file was missing "post-autoload-dump" and the method "postAutoloadDump". I added them from an other project. Now saying that "php artisan package:discover" is not existing, but my current project is on Laravel 5.4, so I think that's why.
– iArcadia
Jun 29 at 13:46