When creating a new Laravel project and running composer update
you might get the following error:
Writing lock file
Generating autoload files
PHP Fatal error: Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath() in /tmp/foo/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php on line 28
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()
Script php artisan clear-compiled handling the post-update-cmd event returned with an error
[RuntimeException]
Error Output: PHP Fatal error: Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath() in /tmp/foo/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand
.php on line 28
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [packages1] ... [packagesN]
See also this issue on Github: https://github.com/laravel/framework/issues/8127
Solution: Delete the file vendor/compiled.php
. Done.