Spark更新至v9.0后找不到laravel-spark-google2fa提供程序类 [英] laravel-spark-google2fa Provider class not found after Spark update to v9.0
问题描述
我最近将 Laravel/Spark 网络应用程序更新为最新版本的Spark(v 9.*
)通过composer
.我使用的另一个软件包是 Laravel-Spark-Google2FA ,我也从v 2.*
.
I recently updated a Laravel/Spark web application to the latest version of Spark (v9.*
) via composer
. Another package I use is Laravel-Spark-Google2FA which I also updated from v1.*
to v2.*
.
设置:
laravel-spark-google2fa软件包具有一个位于/project-root/laravel/spark/src/Providers/Google2FAServiceProvider.php
The laravel-spark-google2fa package has a Laravel service provider class that resides in /project-root/laravel/spark/src/Providers/Google2FAServiceProvider.php
在Laravel中,我们在/project-root/laravel/config/app.php
中用providers
数组中的以下行指定此内容:
In Laravel we specify this in /project-root/laravel/config/app.php
with the following line in the providers
array:
Laravel\Spark\Providers\Google2FAServiceProvider::class,
在composer.json
中,我们有:
"require": {
...
"doctrine/dbal": "^2.5",
"laravel/framework": "^6.0.0",
"eusebiu/laravel-spark-google2fa": "^2.0.0",
"laravel/cashier": "^10.0.0",
"laravel/spark-aurelius": "^9.0.0",
"laravel/tinker": "^1.0.0",
"laravelcollective/html": "^6.0.0",
"webpatser/laravel-uuid": "2.*"
},
"autoload": {
...
"psr-4": {
"App\\": "app/"
}
},
...
注意:除了上面在require
部分中看到的更高版本号外,这是很长一段时间的设置,并且Web应用程序在这段时间内成功运行.
Note: aside from the higher version numbers you see above in the require
section, this has been the setup for a long time with the web application running successfully during that time.
错误:
自从将laravel/spark
升级到laravel/spark-aurelius: ^9.0.0
以来,我们遇到了一个错误,该错误阻止了应用程序运行:
Since we upgraded laravel/spark
to laravel/spark-aurelius: ^9.0.0
we've run into one error which prevents the application from running:
In ProviderRepository.php line 208:
Class 'Laravel\Spark\Providers\Google2FAServiceProvider' not found
尝试失败
我们尝试了以下方法来解决此问题,但没有一个起作用:
We have tried the following to fix this, none of which have worked:
- 运行
php artisan config:clear
- 运行
php artisan cache:clear
- 运行
composer dump-autoload
- 根据运行
php artisan vendor:publish --provider="Eusebiu\LaravelSparkGoogle2FA\Google2FAServiceProvider" --force
的laravel-spark-google2fa文档
- 更改在
app.php
中指定服务提供商的方式
- 在
composer.json
中为 - 将
laravel-spark-google2fa
降级到早期版本 - 删除并重新安装
laravel-spark-google2fa
- 在现有应用程序上运行
spark-installer
autoload
添加了新路径
- running
php artisan config:clear
- running
php artisan cache:clear
- running
composer dump-autoload
- as per laravel-spark-google2fa docs, running
php artisan vendor:publish --provider="Eusebiu\LaravelSparkGoogle2FA\Google2FAServiceProvider" --force
- changing how the service provider is specified in
app.php
- added a new path to
autoload
incomposer.json
- downgrading
laravel-spark-google2fa
to an earlier version - removing and re-installing
laravel-spark-google2fa
- running
spark-installer
over the existing application
在上述所有情况下,错误仍然存在,从而阻止了应用程序运行.
In all of the above cases the error remains, preventing the application from running.
laravel-spark-google2fa
程序包可能最近被放弃了.我在那里打了一个问题,还没有收到回复. Laravel/Spark支持人员未提出解决方案.因此,在放弃此程序包并重构我的代码以使用其他程序包之前,我将在此处发布最后一种手段.
The laravel-spark-google2fa
package may be recently abandoned. I opened an issue there and haven't heard a reply. Laravel/Spark support has not suggested a solution. So I am posting here as a last resort before getting rid of this package and refactoring my code to use a different one.
推荐答案
我不知道引导缓存.引导缓存文件包含对Google2FAServiceProvider
服务提供程序类的引用,该引用在进行各种程序包更新后不再存在.
I was unaware of the bootstrap cache. The bootstrap cache file contained a reference to the Google2FAServiceProvider
service provider class which after various package updates and what not was no longer present.
运行php artisan config:clear
,php artisan cache:clear
和composer dump-autoload
之类的命令不会清除此缓存.最后,我只是删除了有问题的文件:
Running commands like php artisan config:clear
, php artisan cache:clear
, and composer dump-autoload
did not clear this cache. In the end, I simply removed the offending file:
文件名:services.php
位置:/laravel/bootstrap/cache/services.php
config.php
也可以包含此类引用.
config.php
, in the same location, can also contain such references.
注意:我使用VSCode中的查找功能来查找对此服务提供者的引用,但由于引导缓存被忽略,因此找不到该服务提供者.
Note: I used the find feature in VSCode to look for references to this service provider and it did not find this one because the bootstrap cache is gitignored.
这篇关于Spark更新至v9.0后找不到laravel-spark-google2fa提供程序类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!