Laravel 5.2升级-找不到类AuthServiceProvider [英] Laravel 5.2 upgrade - class AuthServiceProvider not found

查看:101
本文介绍了Laravel 5.2升级-找不到类AuthServiceProvider的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在花时间将我的项目从Laravel 4.2升级到Laravel 5.2.

I'm currently spending time to upgrade my project from Laravel 4.2 to Laravel 5.2.

在遇到许多麻烦之后,我设法使5.1版本正确运行,因此按照官方文档中的说明开始了5.1到5.2的过程:

After lots of troubles I managed to get a 5.1 version running correctly so I started the 5.1 to 5.2 procedure as described in the official docs: https://laravel.com/docs/5.2/upgrade#upgrade-5.2.0

第一步之后,我的 composer.json 看起来像这样:

After the first step, my composer.json looks like this:

"require": {
        "laravel/framework": "5.2.*",
        "illuminate/html": "5.*",
        "andywer/js-localization": "dev-laravel-5",
        "laracasts/flash" : "~1.0"
    },
    "require-dev": {
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1",
        "symfony/dom-crawler": "~3.0",
        "symfony/css-selector": "~3.0"
    },
    "autoload": {
        "classmap": [
            "database",
            "app/Models",
            "app/Http/Controllers"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },

我还更新了app.php配置,以删除提供者部分中的ArtisanServiceProvider和ControllerServiceProvider.

I also updated the app.php config to delete ArtisanServiceProvider and ControllerServiceProvider in the providers section.

我的 app.php配置如下所示:

/*
    |--------------------------------------------------------------------------
    | Autoloaded Service Providers
    |--------------------------------------------------------------------------
    |
    | The service providers listed here will be automatically loaded on the
    | request to your application. Feel free to add your own services to
    | this array to grant expanded functionality to your applications.
    |
    */

    'providers' => array(

        /*
         * Laravel Framework Service Providers...
         */
        'Illuminate\Auth\AuthServiceProvider',
        'Illuminate\Broadcasting\BroadcastServiceProvider',
        'Illuminate\Bus\BusServiceProvider',
        'Illuminate\Cache\CacheServiceProvider',
        'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
        'Illuminate\Cookie\CookieServiceProvider',
        'Illuminate\Database\DatabaseServiceProvider',
        'Illuminate\Encryption\EncryptionServiceProvider',
        'Illuminate\Filesystem\FilesystemServiceProvider',
        'Illuminate\Foundation\Providers\FoundationServiceProvider',
        'Illuminate\Hashing\HashServiceProvider',
        'Illuminate\Mail\MailServiceProvider',
        'Illuminate\Pagination\PaginationServiceProvider',
        'Illuminate\Pipeline\PipelineServiceProvider',
        'Illuminate\Queue\QueueServiceProvider',
        'Illuminate\Redis\RedisServiceProvider',
        'Illuminate\Auth\Passwords\PasswordResetServiceProvider',
        'Illuminate\Session\SessionServiceProvider',
        'Illuminate\Translation\TranslationServiceProvider',
        'Illuminate\Validation\ValidationServiceProvider',
        'Illuminate\View\ViewServiceProvider',
        /*
         * Application Service Providers...
         */
        'App\Providers\AppServiceProvider',
        'App\Providers\AuthServiceProvider',
        'App\Providers\EventServiceProvider',
        'App\Providers\RouteServiceProvider',

        // LIBS TIERCE
        JsLocalization\JsLocalizationServiceProvider::class,
        'Laracasts\Flash\FlashServiceProvider',

    ),

    /*
    |--------------------------------------------------------------------------
    | Service Provider Manifest
    |--------------------------------------------------------------------------
    |
    | The service provider manifest is used by Laravel to lazy load service
    | providers which are not needed for each request, as well to keep a
    | list of all of the services. Here, you may set its storage spot.
    |
    */

    'manifest' => storage_path().'/meta',

    /*
    |--------------------------------------------------------------------------
    | Class Aliases
    |--------------------------------------------------------------------------
    |
    | This array of class aliases will be registered when this application
    | is started. However, feel free to register as many as you wish as
    | the aliases are "lazy" loaded so they don't hinder performance.
    |
    */

    'aliases' => array(

        'App'       => Illuminate\Support\Facades\App::class,
        'Artisan'   => Illuminate\Support\Facades\Artisan::class,
        'Auth'      => Illuminate\Support\Facades\Auth::class,
        'Blade'     => Illuminate\Support\Facades\Blade::class,
        'Cache'     => Illuminate\Support\Facades\Cache::class,
        'Config'    => Illuminate\Support\Facades\Config::class,
        'Cookie'    => Illuminate\Support\Facades\Cookie::class,
        'Crypt'     => Illuminate\Support\Facades\Crypt::class,
        'DB'        => Illuminate\Support\Facades\DB::class,
        'Eloquent'  => Illuminate\Database\Eloquent\Model::class,
        'Event'     => Illuminate\Support\Facades\Event::class,
        'File'      => Illuminate\Support\Facades\File::class,
        'Gate'      => Illuminate\Support\Facades\Gate::class,
        'Hash'      => Illuminate\Support\Facades\Hash::class,
        'Lang'      => Illuminate\Support\Facades\Lang::class,
        'Log'       => Illuminate\Support\Facades\Log::class,
        'Mail'      => Illuminate\Support\Facades\Mail::class,
        'Password'  => Illuminate\Support\Facades\Password::class,
        'Queue'     => Illuminate\Support\Facades\Queue::class,
        'Redirect'  => Illuminate\Support\Facades\Redirect::class,
        'Redis'     => Illuminate\Support\Facades\Redis::class,
        'Request'   => Illuminate\Support\Facades\Request::class,
        'Response'  => Illuminate\Support\Facades\Response::class,
        'Route'     => Illuminate\Support\Facades\Route::class,
        'Schema'    => Illuminate\Support\Facades\Schema::class,
        'Session'   => Illuminate\Support\Facades\Session::class,
        'Storage'   => Illuminate\Support\Facades\Storage::class,
        'URL'       => Illuminate\Support\Facades\URL::class,
        'Validator' => Illuminate\Support\Facades\Validator::class,
        'View'      => Illuminate\Support\Facades\View::class,
        'Form'      => 'Illuminate\Html\FormFacade',
        'HTML'      => 'Illuminate\Html\HtmlFacade',

        // FAÇADES TIERCES
        'Flash'             => 'Laracasts\Flash\Flash'

    ),

当然,我清除了引导程序/缓存中的配置缓存,并且我尝试了一切使之起作用的方法,但是每次运行composer update时,我都会得到此错误:

Of course, I cleared the config cache in bootstrap/cache and I tried everything I could to make it work but every time I run composer update I get this error now:

> php artisan clear-compiled


  [Symfony\Component\Debug\Exception\FatalErrorException]
  Class 'App\Providers\AuthServiceProvider' not found


Script php artisan clear-compiled handling the post-update-cmd event returned with an error



  [RuntimeException]
  Error Output:

更糟糕的是,我无法运行任何工匠命令或应用程序页面.每当我在该项目中运行一些php时,我都会不断收到此错误!

worse than this, I can't run any artisan command or pages of my application. I keep getting this error any time I run some php in this project !

这是我尝试过的一些动作:

  • 删除所有缓存,包括配置缓存和services.json(由于工匠命令中的错误,无法重新生成它们)
  • 删除供应商文件夹并重新运行作曲家更新
  • 从app.php配置中删除'Illuminate\Auth\AuthServiceProvider',

以上所有方法均无效,而我的新想法也用光了. 我已经阅读并重新阅读了官方文档的升级指南,似乎与此问题无关...

None of this worked and I'm running out of fresh ideas. I have read and re-read the upgrade guide of the official docs and nothing seems to be related to this issue...

我仍然在Laravel中为所有psr-4/名称空间问题而苦苦挣扎,我认为它可能是由类似的问题引起的,但无法弄清楚到底是什么...

I'm still struggling with all that psr-4 / namespace thing in Laravel and I sense it can be caused something like that but can't figure out what exactly...

推荐答案

您是否在/app/Providers文件夹中的App \ Providers \ AuthServiceProvider中放置了此服务提供商

Do you have this service provider in place App\Providers\AuthServiceProvider in the /app/Providers folder

如果不从此处复制它并修复名称空间

If not copy it from here and fix the namespace

https://github.com/laravel/laravel/blob/master/app/Providers/AuthServiceProvider.php

这篇关于Laravel 5.2升级-找不到类AuthServiceProvider的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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