How to Fix ‘Command “clear-compiled” is not defined’ Error When Upgrading to Laravel 5.2
While trying to upgrade my production app from Laravel 5.1 to 5.2 via composer, I encountered this error message:
Generating autoload files
> php artisan clear-compiled
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "clear-compiled" is not defined.
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output:
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs]
This is unexpected because I did not have any error in my local development environment. Some digging around shows that this has been a long standing bug. But the work around is very easy.
Solution:
Go to your Laravel’s project directory and clear out your caches as followed, and everything will work smoothly again!
$ rm -Rf bootstrap/cache/*
***