Laravel 5.6.26错误-未找到类'Tymon \ JWTAuth \ Providers \ LaravelServiceProvider' [英] Laravel 5.6.26 Error- Class 'Tymon\JWTAuth\Providers\LaravelServiceProvider' not found

查看:322
本文介绍了Laravel 5.6.26错误-未找到类'Tymon \ JWTAuth \ Providers \ LaravelServiceProvider'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

仅供参考,

我浏览了几个Web链接,找到了解决方案,例如更改/添加到 composer.json 文件

I have gone through several web links and found solutions like changing/adding to composer.json file

"tymon/jwt-auth": "^0.5.12" 
"tymon/jwt-auth": "^1.0.0-beta.3" 
"tymon/jwt-auth": "^1.0.0-rc.2"

使用LaravelServiceProvider/JWTAuthServiceProvider的

app.php 配置文件

app.php config file with LaravelServiceProvider/JWTAuthServiceProvider

providers => [
---
        Tymon\JWTAuth\Providers\LaravelServiceProvider::class,

        Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
---
]
aliases => [
-----
'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,
-----
]

还有

composer update --no-scripts
composer update

发布时:

php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"

下面的错误消息.

In ProviderRepository.php line 208:

  Class 'Tymon\JWTAuth\Providers\LaravelServiceProvider' not found

下面的composer更新输出

composer update output below

$composer update

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove laravel/framework v5.6.26
    - Conclusion: don't install laravel/framework v5.6.26
    - Installation request for tymon/jwt-auth 1.0.0-beta.3 -> satisfiable by tymon/jwt-auth[1.0.0-beta.3].
    - Conclusion: don't install laravel/framework v5.6.1
    - Conclusion: don't install laravel/framework v5.6.0
    - tymon/jwt-auth 1.0.0-beta.3 requires illuminate/auth 5.1.* || 5.2.* || 5.3.* || 5.4.* -> satisfiable by illuminate/auth[5.1.x-dev].

    - Installation request for laravel/framework 5.6.* -> satisfiable by laravel/framework[5.6.x-dev].

提前谢谢.

推荐答案

首先,由于您使用的是Laravel 5.6,因此需要具有此版本(1.0.0-rc.2作为最新的稳定版本),然后会有无需隐式地键入提示服务提供商或其外观的别名!图书馆本身将为您这样做.因此,请删除您添加到$providers&中的内容. $aliases数组.

First of all, since you are using Laravel 5.6 you need to have this version (1.0.0-rc.2 as the newest stable version), then there is no need to implicitly type hint the service provider or the alias for its facade! the library itself shall do so for you. So please remove what you've added to $providers & $aliases arrays.

然后确保运行:

composer dump-autoload -o

php artisan clear-compiled

如果您运行的Laravel低于5.6,请告诉我

If you are running less than 5.6 for Laravel, let me know

这篇关于Laravel 5.6.26错误-未找到类'Tymon \ JWTAuth \ Providers \ LaravelServiceProvider'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆