1

我正在尝试使用官方文档将 Laravel 5.3 升级到 5.4

但是当我这样做时:composer update,我得到这个错误:

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,
],

知道是什么产生了错误吗???

4

2 回答 2

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 运行时,它还会安装开发包,这反过来会throw new Exception('It is unsafe to run Dusk in production.');在错误处理程序未捕获的 prod 环境中触发。

composer install --no-dev通过在我的生产环境中运行修复。

于 2017-09-21T16:14:38.593 回答
0

它说的很有趣,因为hash你实际上有Hash

这里回答类似的错误:https ://laracasts.com/discuss/channels/laravel/error-when-upgrading-to-52-class-log-does-not-exist

出于某种原因,有些人似乎不了解 vars 的工作原理并在不添加双引号的情况下添加空格。

错误的

SOME_VAR=某个值

正确的

MY_VAR="一些价值"

于 2017-02-16T14:49:09.093 回答