我正在尝试使用official docs
将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,
],
知道是什么导致错误???
答案 0 :(得分:4)
解决了问题!
由于" laravel / dusk":" ^ 2.0"正在打破。当它在本地机器上运行时一切都很好但是在prod中它会抛出hash not found错误。
看着它并找到了
if ($this->app->environment('production')) {
throw new Exception('It is unsafe to run Dusk in production.');
}
如果env处于prod状态,则DuskServiceProvider会抛出错误,但错误处理程序未捕获错误,从而导致出现奇怪的错误消息。
显然,当运行composer install时,它还会安装dev软件包,而dev软件包又会在错误处理程序未捕获的prod环境中触发throw new Exception('It is unsafe to run Dusk in production.');
。
通过在我的生产环境中运行composer install --no-dev
来解决。
答案 1 :(得分:0)
有趣的是它说hash
,因为你实际上有Hash
这里回答类似的错误:https://laracasts.com/discuss/channels/laravel/error-when-upgrading-to-52-class-log-does-not-exist
有些人似乎并不理解vars是如何工作的,并且在没有添加双引号的情况下添加空格。
错误
SOME_VAR =某个值
正确
MY_VAR =“某些价值”