dthh5038 2018-04-02 02:26
浏览 339

Composer dump-autoload从composer加载自定义文件而不是项目根目录

Laravel version 5.6

I'm attempting to add some classes to my project via files under autoload.

Composer.json

"autoload": {
    "classmap": [
        "database/seeds",
        "database/factories"
    ],
    "psr-4": {
        "App\\": "app/"
    },
    "files" : [
        "app/helpers/dbUsers.php",
        "app/helpers/dbMoodChart.php"
    ]
},

Whenever I do a composer dump-autoload i get errors on both files saying files not found.

PHP Warning: Uncaught ErrorException: require(C:\laravel-projects\project\vendor\composer/../../app/helpers/dbUsers.php): failed to open stream: No such file or directory in C:\laravel-projects\project\vendor\composer\autoload_real.php:66 Stack trace:

Warning: Uncaught ErrorException: require(C:\laravel-projects\MoodWatch\vendor\composer/../../app/helpers/dbUsers.php): failed to open stream: No such file or directory in C:\laravel-projects\MoodWatch\vendor\composer\autoload_real.php:66 Stack trace:

The strange thing is its trying to load the files from the composer directory not the apps root folder. I've done this in another project and didn't have any issues. I've also compared my composer.json autoload sections on both projects and I can't see any syntax differences so I'm a bit puzzled as to why it's loading at the wrong location.

Has anyone seen anything similar before and be able to shed light on why it's doing this?

  • 写回答

1条回答 默认 最新

  • duanniu4106 2018-04-02 07:30
    关注

    I found out the name of the file had a typo and once fixed both errors went away

    评论

报告相同问题?

悬赏问题

  • ¥30 雷达辐射源信号参考模型
  • ¥15 html+css+js如何实现这样子的效果?
  • ¥15 STM32单片机自主设计
  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢
  • ¥15 不小心不正规的开发公司导致不给我们y码,
  • ¥15 我的代码无法在vc++中运行呀,错误很多
  • ¥50 求一个win系统下运行的可自动抓取arm64架构deb安装包和其依赖包的软件。
  • ¥60 fail to initialize keyboard hotkeys through kernel.0000000000
  • ¥30 ppOCRLabel导出识别结果失败
  • ¥15 Centos7 / PETGEM