0

I'm working within the Laravel framework, and have a file loading successfully, pulled in through my Composer's files array. I can run composer update locally without issue -- I'm using the functions in the file.

However, when deploying to Digital Ocean, Composer throws an error, suggesting that it's looking for the file in the vendors directory (even though it's not looking there locally).

Fatal error: composerRequire0b4716b00b8bec4a70dbf5ea5e415661(): Failed opening required '/home/forge/myapp.com/vendor/composer/../../app/helpers/myHelper.php' (include_path='.:/usr/share/php') in /home/forge/myapp.com/vendor/composer/autoload_real.php on line 66

And the autoload section:

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

I think this question probably has what I need but I don't know if the difference between loading classes and files makes it irrelevant to this issue (clearly I'm confused about more than just this issue!):

How to I use Composer to autoload classes from outside the vendor?

Unamata Sanatarai
  • 6,475
  • 3
  • 29
  • 51
Chords
  • 6,720
  • 2
  • 39
  • 61
  • did you try `composer dump-autoload` and `php artisan dump-autoload` – Webdesigner Oct 13 '17 at 23:12
  • Some of your files are missing. Try reuploading or reinstalling laravel on your host. – Michael Oshosanya Oct 13 '17 at 23:14
  • looks fine to me, and it seems to try loading from the correct location as well. You are sure the file exists (at `/home/forge/myapp.com/app/helpers/myHelper.php`), and is readable by php? If you just `require` the file when bootstrapping the app, in stead of loading it trough composer, does it fail as well? – Pevara Oct 13 '17 at 23:20
  • Don't run `composer update` in production. Commit `composer.lock` file and run `composer install`. – svgrafov Oct 14 '17 at 01:03
  • Thanks, all. Not sure what it was but I updated my Vagrant box, re-deployed to Digital Ocean, and things seem to be working in both places. Wish I did one thing at a time to speak to the actual issue, but.. too frustrated! – Chords Oct 14 '17 at 16:11

1 Answers1

-2

try to delete all text in composer.lock and update composer

Ani
  • 42
  • 6