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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了为什么运行composer install --no-dev我在Barryvdh Debugbar ServiceProvider中出错?相关的知识,希望对你有一定的参考价值。

我在实时服务器上安装我的laravel 5.7应用程序(生产)并且没有dev tools命令命令我收到错误:

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中,我在dev块下有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中删除ll行:

Barryvdh\Debugbar

以上是关于为什么运行composer install --no-dev我在Barryvdh Debugbar ServiceProvider中出错?的主要内容,如果未能解决你的问题,请参考以下文章

运行composer install时如何解决两个包需求冲突?

如何从 php 容器中的 dockerfile 运行 composer install

运行 composer install 命令时出错

开始使用chef,并在部署时运行composer install

运行 composer install 时从 shell_exec 获取整个输出

composer的安装方法 以及 ThinkPHP5安装