首页 > 解决方案 > Why running composer install --no-dev I got error with Barryvdh\Debugbar\ServiceProvider?

问题描述

I install my laravel 5.7 app (production) at live server and with no dev tools command command I got error:

composer install --no-dev
...

  - Removing barryvdh/laravel-debugbar (v3.2.1)
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover

In ProviderRepository.php line 208:

  Class 'Barryvdh\Debugbar\ServiceProvider' not found  



Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1

In my composer.json I have barryvdh/laravel-debugbar under dev block:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": "^7.1.3",
        ...
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.1",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "orangehill/iseed": "^2.6",
        "phpunit/phpunit": "^7.0",
        "xethron/migrations-generator": "^2.0"
    },

In my config/app.php I have :

'providers' => [
    ...
    Barryvdh\Debugbar\ServiceProvider::class,
'aliases' => [
    ...
    'Debugbar'         => Barryvdh\Debugbar\Facade::class,

Why this error and how to fix it?

Thanks!

标签: laravel-5production-environment

解决方案


Before running

composer install --no-dev

1) Clear bootstrap/cache subdirectory as mentioned above 2) remove /vendor/ directory if you have it 3) Remove from config/app.php  ll lines with :

Barryvdh\Debugbar

推荐阅读