尝试升级到laravel 5.3,但仍然看到错误`调用未定义的方法Illuminate \ Auth \ Access \ Gate :: abilities`

问题描述

我正在尝试将laravel 5.3从5.2升级,但是我在日志文件中始终看到这两个错误

Symfony\Component\Debug\Exception\FatalErrorException: Uncaught Error: Call to undefined method Illuminate\Auth\Access\Gate::abilities() in /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.PHP:237

还有一个

Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\Log\Writer::setHandlers() in Command line code:1

完整堆栈输出

[2020-08-13 08:26:58] local.ERROR: Symfony\Component\Debug\Exception\FatalErrorException: Uncaught Error: Call to undefined method Illuminate\Auth\Access\Gate::abilities() in /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.PHP:237
Stack trace:
#0 Command line code(1): Illuminate\Support\Facades\Facade::__callStatic('abilities',Array)
#1 {main}
  thrown in /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.PHP:237
[2020-08-13 08:26:58] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\Log\Writer::setHandlers() in Command line code:1
Stack trace:
#0 [internal function]: VscodeLaravelExtraIntellisenseProvider->boot()
#1 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Container/Container.PHP(508): call_user_func_array(Array,Array)
#2 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Application.PHP(769): Illuminate\Container\Container->call(Array)
#3 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Application.PHP(752): Illuminate\Foundation\Application->bootProvider(Object(VscodeLaravelExtraIntellisenseProvider))
#4 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Object(VscodeLaravelExtraIntellisenseProvider),2)
#5 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Application.PHP(753): array_walk(Array,Object(Closure))
#6 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.PHP(17): Illuminate\Foundation\Application->boot()
#7 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Application.PHP(203): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#8 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.PHP(267): Illuminate\Foundation\Application->bootstrapWith(Array)
#9 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.PHP(113): Illuminate\Foundation\Console\Kernel->bootstrap()
#10 Command line code(1): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput),Object(Symfony\Component\Console\Output\ConsoleOutput))

我不知道这些是哪里来的以及如何解决它们。

更新:我每隔41秒就会看到这些错误。示例13:35:41 但是根据我在宅基地的crontab的说法,我没有安排任何克朗

更新2:https://github.com/illuminate/auth/blob/5.5/Access/Gate.php功能方法存在于5.5中。但我仍然是5.3。很奇怪,但我不知道该怎么调用代码。也许是第三方套餐。

解决方法

https://marketplace.visualstudio.com/items?itemName=amiralizadeh9480.laravel-extra-intellisense

此VS Code扩展引起了2个错误,它试图每分钟进行编译,因此非常混乱,感觉就像是在后台运行的cron作业。

,

请尝试查找官方文档以获取升级指南。它们涉及很多问题,也许您找到了自己的问题。这是一个非常具体的问题,您在代码中丢失了一些内容,但是从一个问题来看,我们不知道。 https://laravel.com/docs/5.3/upgrade#upgrade-5.3.0

也可以尝试Rector进行升级,或者升级后https://github.com/rectorphp/rector