I am trying to upgrade Laravel 5.3 to 5.4, with official docs
But when I do: composer update, I get this error:
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
> IlluminateFoundationComposerScripts::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): IlluminateContainerContainer->build('hash')
#2 .../vendor/laravel/framework/src/Illuminate/Foundation/Application.php(702): IlluminateContainerContainer->make('hash')
#3 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(1070): IlluminateFoundationApplication->make('hash')
#4 .../vendor/laravel/framework/src/Illuminate/Auth/CreatesUserProviders.php(65): IlluminateContainerContain 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): IlluminateContainerContainer->build('hash')
#2 .../vendor/laravel/framework/src/Illuminate/Foundation/Application.php(702): IlluminateContainerContainer->make('hash')
#3 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(1070): IlluminateFoundationApplication->make('hash')
#4 .../vendor/laravel/framework/src/Illuminate/Auth/CreatesUserProviders.php(65): IlluminateContainerContain 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
Also, here is the list of providers in my app.php
'providers' => [
/*
* Laravel Framework Service Providers...
*/
IlluminateAuthAuthServiceProvider::class,
IlluminateBroadcastingBroadcastServiceProvider::class,
IlluminateBusBusServiceProvider::class,
IlluminateCacheCacheServiceProvider::class,
IlluminateFoundationProvidersConsoleSupportServiceProvider::class,
IlluminateCookieCookieServiceProvider::class,
IlluminateDatabaseDatabaseServiceProvider::class,
IlluminateEncryptionEncryptionServiceProvider::class,
IlluminateFilesystemFilesystemServiceProvider::class,
IlluminateFoundationProvidersFoundationServiceProvider::class,
IlluminateHashingHashServiceProvider::class,
IlluminateMailMailServiceProvider::class,
IlluminateNotificationsNotificationServiceProvider::class,
IlluminatePaginationPaginationServiceProvider::class,
IlluminatePipelinePipelineServiceProvider::class,
IlluminateQueueQueueServiceProvider::class,
IlluminateRedisRedisServiceProvider::class,
IlluminateAuthPasswordsPasswordResetServiceProvider::class,
IlluminateSessionSessionServiceProvider::class,
IlluminateTranslationTranslationServiceProvider::class,
IlluminateValidationValidationServiceProvider::class,
IlluminateViewViewServiceProvider::class,
/*
* Package Service Providers...
*/
LaravelSocialiteSocialiteServiceProvider::class,
TorannGeoIPGeoIPServiceProvider::class,
MaatwebsiteExcelExcelServiceProvider::class,
BarryvdhDebugbarServiceProvider::class,
BarryvdhLaravelIdeHelperIdeHelperServiceProvider::class,
BarryvdhSnappyServiceProvider::class,
DaveJamesMillerBreadcrumbsServiceProvider::class,
CviebrockEloquentSluggableServiceProvider::class,
SpatieBackupBackupServiceProvider::class,
SpatieLinkCheckerLinkCheckerServiceProvider::class,
ArtesaosSEOToolsProvidersSEOToolsServiceProvider::class,
ProengsoftJsValidationJsValidationServiceProvider::class,
ThomasweltonLaravelGravatarLaravelGravatarServiceProvider::class,
InterventionImageImageServiceProvider::class,
OwenItAuditingAuditingServiceProvider::class,
BarryvdhTranslationManagerManagerServiceProvider::class,
SentrySentryLaravelSentryLaravelServiceProvider::class,
CollectiveHtmlHtmlServiceProvider::class,
LaravoltAvatarServiceProvider::class,
LaravelPassportPassportServiceProvider::class,
Rap2hpoutreLaravelLogViewerLaravelLogViewerServiceProvider::class,
/*
* Application Service Providers...
*/
AppProvidersAppServiceProvider::class,
// AppProvidersBroadcastServiceProvider::class,
AppProvidersAuthServiceProvider::class,
AppProvidersEventServiceProvider::class,
AppProvidersRouteServiceProvider::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' => IlluminateSupportFacadesApp::class,
'Artisan' => IlluminateSupportFacadesArtisan::class,
'Auth' => IlluminateSupportFacadesAuth::class,
'Blade' => IlluminateSupportFacadesBlade::class,
'Cache' => IlluminateSupportFacadesCache::class,
'Config' => IlluminateSupportFacadesConfig::class,
'Cookie' => IlluminateSupportFacadesCookie::class,
'Crypt' => IlluminateSupportFacadesCrypt::class,
'DB' => IlluminateSupportFacadesDB::class,
'Eloquent' => IlluminateDatabaseEloquentModel::class,
'Event' => IlluminateSupportFacadesEvent::class,
'File' => IlluminateSupportFacadesFile::class,
'Gate' => IlluminateSupportFacadesGate::class,
'Hash' => IlluminateSupportFacadesHash::class,
'Lang' => IlluminateSupportFacadesLang::class,
'Log' => IlluminateSupportFacadesLog::class,
'Mail' => IlluminateSupportFacadesMail::class,
'Notification' => IlluminateSupportFacadesNotification::class,
'Password' => IlluminateSupportFacadesPassword::class,
'Queue' => IlluminateSupportFacadesQueue::class,
'Redirect' => IlluminateSupportFacadesRedirect::class,
'Redis' => IlluminateSupportFacadesRedis::class,
'Request' => IlluminateSupportFacadesRequest::class,
'Response' => IlluminateSupportFacadesResponse::class,
'Route' => IlluminateSupportFacadesRoute::class,
'Schema' => IlluminateSupportFacadesSchema::class,
'Session' => IlluminateSupportFacadesSession::class,
'Storage' => IlluminateSupportFacadesStorage::class,
'URL' => IlluminateSupportFacadesURL::class,
'Validator' => IlluminateSupportFacadesValidator::class,
'View' => IlluminateSupportFacadesView::class,
'Form' => CollectiveHtmlFormFacade::class,
'Html' => CollectiveHtmlHtmlFacade::class,
'Countries' => WebpatserCountriesCountriesFacade::class,
'Socialize' => LaravelSocialiteFacadesSocialite::class,
'GeoIP' => TorannGeoIPFacadesGeoIP::class,
'Excel' => MaatwebsiteExcelFacadesExcel::class,
'Debugbar' => BarryvdhDebugbarFacade::class,
'Breadcrumbs' => DaveJamesMillerBreadcrumbsFacade::class,
'SEOMeta' => ArtesaosSEOToolsFacadesSEOMeta::class,
'OpenGraph' => ArtesaosSEOToolsFacadesOpenGraph::class,
'Twitter' => ArtesaosSEOToolsFacadesTwitterCard::class,
'SEO' => ArtesaosSEOToolsFacadesSEOTools::class,
'JsValidator' => ProengsoftJsValidationFacadesJsValidatorFacade::class,
'Gravatar' => ThomasweltonLaravelGravatarFacadesGravatar::class,
'Image' => InterventionImageFacadesImage::class,
'Sentry' => SentrySentryLaravelSentryFacade::class,
'Avatar' => LaravoltAvatarFacade::class,
'PDF' => BarryvdhSnappyFacadesSnappyPdf::class,
'SnappyImage' => BarryvdhSnappyFacadesSnappyImage::class,
],
Any idea what’s generating the error???
2
Answers
It is interesting it says
hash
, becasuse you actually haveHash
Here answer to similar error: https://laracasts.com/discuss/channels/laravel/error-when-upgrading-to-52-class-log-does-not-exist
Solved issue!
Was breaking because of “laravel/dusk”: “^2.0”. When it was running on local machine everything was fine but when in prod it would throw hash not found error.
Looked in to it and found
DuskServiceProvider throws an error if env is in prod but the error is not picked up by the error handler which resulted in weird error message.
Apparently when composer install is run it also installs dev packages Which in turn triggers
throw new Exception('It is unsafe to run Dusk in production.');
in a prod environment which is not caught by the error handler.Fixed by running
composer install --no-dev
in my production environment.