为什么运行composer install --no-dev我遇到Barryvdh \ Debugbar \ ServiceProvider错误?

时间:2019-03-02 15:35:22

标签: laravel-5 production-environment

我在实时服务器上安装了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,

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

谢谢!

1 个答案:

答案 0 :(得分:0)

运行之前

composer install --no-dev

1)如上所述清除bootstrap / cache子目录 2)删除/ vendor /目录(如果有) 3)用:

从config / app.php ll行中删除
Barryvdh\Debugbar