为什么 运行 composer install --no-dev Barryvdh\Debugbar\ServiceProvider 出错?

Why running composer install --no-dev I got error with Barryvdh\Debugbar\ServiceProvider?

我在实时服务器上安装了我的 laravel 5.7 应用程序(生产),但没有开发工具命令,我收到错误消息:

composer install --no-dev
...

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

在 ProviderRepository.php 行 208:

  Class 'Barryvdh\Debugbar\ServiceProvider' not found  



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

在我的 composer.json 我有 barryvdh/laravel-debugbar 在开发块下:

{
    "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"
    },

在我的 config/app.php 我有 :

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

为什么会出现这个错误以及如何解决?

谢谢!

之前 运行

composer install --no-dev

1) 如上所述清除 bootstrap/cache 子目录 2) 删除 /vendor/ 目录(如果有) 3) 从 config/app.php 删除带有 :

的所有行
Barryvdh\Debugbar