Composer / Laravel致命错误

时间:2015-10-26 12:04:17

标签: php laravel composer-php

我将此添加到我的composer.json文件

:

然后,我从命令行运行"autoload": { "classmap": [ "database" ], "psr-4": { "App\\": "app/", "Claremontdesign\\Cdbase\\": "packages/Claremontdesign/cdbase/src", "Claremontdesign\\Narbase\\": "packages/Claremontdesign/narbase/src", "Claremontdesign\\Nhr\\": "packages/Claremontdesign/nhr/src" }, "files": [ "packages/Claremontdesign/cdbase/src/Helpers/helpers.php", "packages/Claremontdesign/narbase/src/Helpers/helpers.php", "packages/Claremontdesign/nhr/src/Helpers/helpers.php" ] }, ,它给了我这个错误:

  

symfony组件调试异常fatalerrorexception类“找不到Claremontdesign \ Cdbase \ ServiceProvider”

还有其他人遇到过这个吗?

另外,我在add.php中添加了一个服务提供程序

composer update

2 个答案:

答案 0 :(得分:0)

我认为你在每个src文件夹后都缺少一个斜杠

"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "App\\": "app/",
        "Claremontdesign\\Cdbase\\": "packages/Claremontdesign/cdbase/src/",
        "Claremontdesign\\Narbase\\": "packages/Claremontdesign/narbase/src/",
        "Claremontdesign\\Nhr\\": "packages/Claremontdesign/nhr/src/"
    },
   "files": [
        "packages/Claremontdesign/cdbase/src/Helpers/helpers.php",
        "packages/Claremontdesign/narbase/src/Helpers/helpers.php",
        "packages/Claremontdesign/nhr/src/Helpers/helpers.php"
    ]
},

答案 1 :(得分:0)

您是否尝试仅运行composer dumpcomposer update在实际运行之前运行一些脚本 - 例如php artisan clear-compiled。当工匠运行时,它可能会失败,因为它试图注册尚未自动加载的serviceprovider。 composer dump仅生成自动加载文件,这是您在这种情况下所需的文件。