我正在尝试安装Laravel新项目并得到此错误
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Error
Error
Call to undefined method ReflectionFunction::isAnonymous()
at vendor/laravel/framework/src/Illuminate/Container/Container.php:681
677▕ protected function getClassForCallable($callback)
678▕ {
679▕ if (PHP_VERSION_ID >= 80200) {
680▕ if (is_callable($callback) &&
➜ 681▕ ! ($reflector = new ReflectionFunction($callback(...)))->isAnonymous()) {
682▕ return $reflector->getClosureScopeClass()->name ?? false;
683▕ }
684▕
685▕ return false;
+3 vendor frames
4 [internal]:0
Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Illuminate\Database\DatabaseServiceProvider))
+5 vendor frames
10 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
4 artisan:51
Illuminate\Foundation\Console\Kernel::terminate(Object(Symfony\Component\Console\Input\ArgvInput))
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
“php”:“^8.1”
“laravel/framework”:“^10.8”
Composer版本2.5.5
已完成composer clearcache
composer update
composer global update
composer selfupdate
composer self-update --rollback
等...
如果我运行任何artisan命令,它会显示相同的错误。
1条答案
按热度按时间dzhpxtsq1#
Laravel 10.x需要最低PHP版本8.1。请检查您的PHP版本