Ошибка обновления с L5.4 до L5.4: Uncaught ReflectionException: хэш класса не существует в src/Illuminate/Container/Container.php:681

Я пытаюсь обновить Laravel 5.3 до 5.4 с помощью официальной документации.

Но когда я делаю: обновление композитора, я получаю эту ошибку:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 15 updates, 11 removals
- Removing graham-campbell/htmlmin (v4.5.0)
- Removing jeremeamia/superclosure (2.3.0)
- Removing classpreloader/classpreloader (3.1.0)
- Removing symfony/polyfill-php56 (v1.3.0)
- Removing symfony/polyfill-util (v1.3.0)
- Removing nikic/php-parser (v2.1.1)
- Removing mrclay/minify (2.3.0)
- Removing psy/psysh (v0.7.2)
- Removing dnoegel/php-xdg-base-dir (0.1)
- Removing jakub-onderka/php-console-highlighter (v0.3.2)
- Removing jakub-onderka/php-console-color (0.1)
- Updating symfony/var-dumper (v3.1.9 => v3.2.2) Loading from cache
- Updating symfony/routing (v3.1.9 => v3.2.2) Downloading: 100%
- Updating symfony/process (v3.1.9 => v3.2.2) Downloading: 100%
- Updating symfony/debug (v3.1.9 => v3.2.2) Downloading: 100%
- Updating symfony/http-foundation (v3.1.9 => v3.2.2) Downloading: 100%
- Updating symfony/http-kernel (v3.1.9 => v3.2.2) Downloading: 100%
- Updating symfony/finder (v3.1.9 => v3.2.2) Downloading: 100%
- Updating symfony/console (v3.1.9 => v3.2.2) Downloading: 100%
- Updating symfony/translation (v3.1.9 => v3.2.2) Loading from cache
- Installing erusev/parsedown (1.6.1) Loading from cache
- Updating laravel/framework (v5.3.20 => v5.4.6) Downloading: 100%
- Removing laravelcollective/html (dev-master c4c8791)
- Installing laravelcollective/html (5.4.x-dev 7570f25) Downloading: 100%
- Updating laravel/socialite (v2.0.20 => v3.0.0) Downloading: 100%
- Updating spatie/laravel-backup (3.10.2 => 3.10.1) Downloading: 100%
- Updating owen-it/laravel-auditing (2.4.5 => 2.3.7) Downloading: 100%
- Updating laravel/passport (v1.0.17 => v2.0.1) Downloading: 100%
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
PHP Fatal error:  Uncaught ReflectionException: Class hash does not exist in .../vendor/laravel/framework/src/Illuminate/Container/Container.php:681
Stack trace:
#0 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(681): ReflectionClass->__construct('hash')
#1 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(565): Illuminate\Container\Container->build('hash')
#2 .../vendor/laravel/framework/src/Illuminate/Foundation/Application.php(702): Illuminate\Container\Container->make('hash')
#3 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(1070): Illuminate\Foundation\Application->make('hash')
#4 .../vendor/laravel/framework/src/Illuminate/Auth/CreatesUserProviders.php(65): Illuminate\Container\Contain in .../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 681
PHP Fatal error:  Uncaught ReflectionException: Class hash does not exist in .../vendor/laravel/framework/src/Illuminate/Container/Container.php:681
Stack trace:
#0 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(681): ReflectionClass->__construct('hash')
#1 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(565): Illuminate\Container\Container->build('hash')
#2 .../vendor/laravel/framework/src/Illuminate/Foundation/Application.php(702): Illuminate\Container\Container->make('hash')
#3 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(1070): Illuminate\Foundation\Application->make('hash')
#4 .../vendor/laravel/framework/src/Illuminate/Auth/CreatesUserProviders.php(65): Illuminate\Container\Contain in .../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 681
Script php artisan optimize handling the post-update-cmd event returned with error code 255

Кроме того, вот список провайдеров в моем app.php

'providers' => [

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

    /*
     * Package Service Providers...
     */

    Laravel\Socialite\SocialiteServiceProvider::class,
    Torann\GeoIP\GeoIPServiceProvider::class,
    Maatwebsite\Excel\ExcelServiceProvider::class,
    Barryvdh\Debugbar\ServiceProvider::class,
    Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
    Barryvdh\Snappy\ServiceProvider::class,
    DaveJamesMiller\Breadcrumbs\ServiceProvider::class,
    Cviebrock\EloquentSluggable\ServiceProvider::class,
    Spatie\Backup\BackupServiceProvider::class,
    Spatie\LinkChecker\LinkCheckerServiceProvider::class,
    Artesaos\SEOTools\Providers\SEOToolsServiceProvider::class,
    Proengsoft\JsValidation\JsValidationServiceProvider::class,
    Thomaswelton\LaravelGravatar\LaravelGravatarServiceProvider::class,
    Intervention\Image\ImageServiceProvider::class,
    OwenIt\Auditing\AuditingServiceProvider::class,
    Barryvdh\TranslationManager\ManagerServiceProvider::class,
    Sentry\SentryLaravel\SentryLaravelServiceProvider::class,
    Collective\Html\HtmlServiceProvider::class,
    Laravolt\Avatar\ServiceProvider::class,
    Laravel\Passport\PassportServiceProvider::class,
    Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider::class,


    /*
     * Application Service Providers...
     */
    App\Providers\AppServiceProvider::class,
    // App\Providers\BroadcastServiceProvider::class,
    App\Providers\AuthServiceProvider::class,
    App\Providers\EventServiceProvider::class,
    App\Providers\RouteServiceProvider::class,


],

/*
|--------------------------------------------------------------------------
| 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' => [

    '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,
    'Notification' => Illuminate\Support\Facades\Notification::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'      => Collective\Html\FormFacade::class,
    'Html'      => Collective\Html\HtmlFacade::class,
    'Countries' => Webpatser\Countries\CountriesFacade::class,
    'Socialize' => Laravel\Socialite\Facades\Socialite::class,
    'GeoIP' => Torann\GeoIP\Facades\GeoIP::class,
    'Excel' => Maatwebsite\Excel\Facades\Excel::class,
    'Debugbar' => Barryvdh\Debugbar\Facade::class,
    'Breadcrumbs' => DaveJamesMiller\Breadcrumbs\Facade::class,
    'SEOMeta'   => Artesaos\SEOTools\Facades\SEOMeta::class,
    'OpenGraph' => Artesaos\SEOTools\Facades\OpenGraph::class,
    'Twitter'   => Artesaos\SEOTools\Facades\TwitterCard::class,
    'SEO' => Artesaos\SEOTools\Facades\SEOTools::class,
    'JsValidator' => Proengsoft\JsValidation\Facades\JsValidatorFacade::class,
    'Gravatar' => Thomaswelton\LaravelGravatar\Facades\Gravatar::class,
    'Image' => Intervention\Image\Facades\Image::class,
    'Sentry' => Sentry\SentryLaravel\SentryFacade::class,
    'Avatar'    => Laravolt\Avatar\Facade::class,
    'PDF' => Barryvdh\Snappy\Facades\SnappyPdf::class,
    'SnappyImage' => Barryvdh\Snappy\Facades\SnappyImage::class,
],

Любая идея, что генерирует ошибку???


person Juliatzin    schedule 27.01.2017    source источник
comment
У вас такая же проблема, не могу найти хороший ответ, вы разобрались?   -  person Marcus    schedule 21.09.2017


Ответы (2)


Решенная проблема!

Ломался из-за "laravel/dusk": "^2.0". Когда он работал на локальной машине, все было в порядке, но когда в prod он выдавал ошибку hash not found.

Заглянул в него и нашел

    if ($this->app->environment('production')) {
        throw new Exception('It is unsafe to run Dusk in production.');
    }

DuskServiceProvider выдает ошибку, если env находится в prod, но ошибка не улавливается обработчиком ошибок, что приводит к странному сообщению об ошибке.

По-видимому, при запуске composer install он также устанавливает пакеты dev, что, в свою очередь, запускает throw new Exception('It is unsafe to run Dusk in production.'); в рабочей среде, которая не перехватывается обработчиком ошибок.

Исправлено запуском composer install --no-dev в моей производственной среде.

person Marcus    schedule 21.09.2017

Интересно, что там написано hash, потому что у вас на самом деле есть Hash

Вот ответ на аналогичную ошибку: https://laracasts.com/discuss/channels/laravel/error-when-upgrading-to-52-class-log-does-not-exist

Некоторые люди, кажется, не понимают, как работают переменные, и почему-то добавляют пробелы без добавления двойных кавычек.

Неправильный

SOME_VAR=некоторое значение

Верный

MY_VAR=некоторое значение

person Petr Reshetin    schedule 16.02.2017