【问题标题】:Trying to upgrade to laravel 5.3 but I keep seeing error `Call to undefined method Illuminate\Auth\Access\Gate::abilities()`尝试升级到 laravel 5.3,但我一直看到错误“调用未定义的方法 Illuminate\Auth\Access\Gate::abilities()”
【发布时间】:2020-08-13 10:30:37
【问题描述】:

我正在尝试从 5.2 升级 laravel 5.3,但我在日志文件中不断看到这两个错误:

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,我没有安排任何 crons

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

【问题讨论】:

    标签: php laravel symfony laravel-5


    【解决方案1】:

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

    这个 VS Code 扩展导致了 2 个错误,它试图每分钟编译一些东西,因此非常混乱,感觉就像在后台运行一个 cron 作业。

    【讨论】:

    • som 你是怎么解决这个问题的?
    • 我删除了扩展 lol
    【解决方案2】:

    尝试在官方文档中查找升级指南。它们涵盖了很多问题,也许你会找到你的。这是一个非常具体的问题,您的代码中缺少某些内容,但从一个问题来看,我们无法知道。 https://laravel.com/docs/5.3/upgrade#upgrade-5.3.0

    还可以尝试Rector 进行升级或升级后出现任何问题https://github.com/rectorphp/rector

    【讨论】:

    • 我已完成所有步骤,并且能够解决除这两个之外的所有其他错误。现在,当我深入挖掘时,似乎Gate::abilities 出现在 5.5 中。但是有些东西已经在 5.3 中调用了该方法。不知道为什么。 :) 另一种方法,我什至在以后的版本中都找不到。
    • 也许是一些包裹?你追踪到哪里被调用了吗?
    猜你喜欢
    • 2016-06-25
    • 2017-04-07
    • 2017-05-15
    • 2023-04-01
    • 2017-05-06
    • 2019-02-14
    • 2017-11-23
    • 2019-03-04
    • 2017-06-10
    相关资源
    最近更新 更多