Home > Net >  Composer doesn't find file set up on "files" autoloading mechanism of composer.json
Composer doesn't find file set up on "files" autoloading mechanism of composer.json

Time:03-31

I have a Laravel project that I cloned from Bitbucket. Why is this happening? Why doesn't Composer find the file Helper.php in the folder although it is there? I have already read many similar problems, but none of the solutions worked for me.

composer.json

"autoload": {
    "psr-4": {
        "App\\": "app/",
        "Database\\Factories\\": "database/factories/",
        "Database\\Seeders\\": "database/seeders/"
    },
    "files": [
        "App/Helpers/Helper.php"
    ]
},

I have the following folder structure inside the project: app > Helpers > Helper.php. But for some reason, when I run composer install, I get an error as follows at the end of execution.

Illuminate\Foundation\ComposerScripts::postAutoloadDump Script Illuminate\Foundation\ComposerScripts::postAutoloadDump handling the post-autoload-dump event terminated with an exception [ErrorException]
require(/var/www/html/acessoportal/vendor/composer/../../App/Helpers/Helper.php): Failed to open stream: No such file or directory

CodePudding user response:

Change App in the file path to lower case version app:

...
"files": [
    "app/Helpers/Helper.php"
    ]
...
  • Related