Laravel - 学说/ dbal的安装失败了

时间:2017-06-21 13:54:50

标签: laravel doctrine composer-php

我正在尝试在我正在使用的遗留代码上安装doctrine / dbal。在尝试运行composer require doctrine/dbal时,我收到错误:

  

[RuntimeException的]
  无法扫描内部的课程" app / Libs"哪个看起来不像   是文件也不是文件夹

这是composer.json文件:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*",
        "jgrossi/corcel": "^1.4",
        "ellipsesynergie/api-response": "^0.12.3",
        "corcel/acf": "^0.1.12"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "symfony/css-selector": "2.8.*|3.0.*",
        "symfony/dom-crawler": "2.8.*|3.0.*"
    },
    "autoload": {
        "classmap": [
            "database",
            "app/Libs"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "pre-update-cmd": [
            "php artisan clear-compiled"
        ],
        "post-update-cmd": [
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

我该如何解决?

1 个答案:

答案 0 :(得分:1)

也许问题是您将app文件夹添加到psr-4部分,然后app\Libs添加到类图? 尝试将其删除:

"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "App\\": "app/"
    }
},

您已经说过要扫描app文件夹,然后再次尝试扫描。