Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

broefs's avatar

Forge deployment fails related to vendor/autoload.php

I have a bitbucket repository started as Laravel 5.1 and over time updated to 5.4. Whenever I try to deploy using Forge I get something like:

Cloning into 'mysite'...

php artisan clear-compiled PHP Warning: require(/home/forge/mysite/vendor/autoload.php): failed to open stream: No such file or directory in /home/forge/mysite/artisan on line 18

Warning: require(/home/forge/mysite/vendor/autoload.php): failed to open stream: No such file or directory in /home/forge/mysite/artisan on line 18 PHP Fatal error: require(): Failed opening required '/home/forge/mysite/vendor/autoload.php' (include_path='.:/usr/share/php') in /home/forge/mysite/artisan on line 18

Fatal error: require(): Failed opening required '/home/forge/mysite/vendor/autoload.php' (include_path='.:/usr/share/php') in /home/forge/mysite/artisan on line 18 Script php artisan clear-compiled handling the pre-update-cmd event returned with error code 255

I then install from Forge with 'Install Composer Dependencies' switched off and I SSH into the machine and run composer install --no-scripts and subsequently the standard deployment script. This solves the problem but is a pain to have to do this for each new deployment.

Any suggestions?

0 likes
7 replies
ejdelmonico's avatar

Check your syntax in all config files. That is where to start with that error. Probably a small error that is hard to notice. Especially check for missing commas in config/app.php.

broefs's avatar

Thanks for suggestion @ejdelmonico. Checked all and did one update to config/app.php, but does not solve the problem. Can you explain why you advise me to check these, perhaps it can give me an idea where else to look?

ejdelmonico's avatar

I have had the same message before because of syntax error from adding services. Hopefully, you ran composer dump-autoload after any corrections.

You can also try this: remove bootstrap/cache/config.php and run composer dump-autoload.

broefs's avatar

On my local machine composer install, composer dump-autoload, composer update on my local are all fine. All I get is a warning:

Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead.

Does not seem relevant. On Forge server still getting : Failed opening required '/home/forge/mysite/vendor/autoload.php'

wildson's avatar

broefs, did you ever manage to get this fixed? I seem to have the same problem:

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
PHP Warning:  Uncaught ErrorException: require(/home/forge/default/vendor/composer/../../tests/utilities/functions.php): failed to open stream: No such file or directory in /home/forge/default/vendor/composer/autoload_real.php:66

Things seem fine on my Homestead site - have run 'composer update', 'composer dump-autoload', 'composer install' etc. It is just when I try to upload my repository (Bitbucket) to my Vultr site using Forge that I get the problem. Could it be my .gitignore file?

This is what I currently have:

/node_modules
/public/hot
/public/storage
/storage/\*.key
/vendor
/.idea
/.vagrant
Homestead.json
Homestead.yaml
npm-debug.log
.env
.DS_Store
/public/js/app.js
/.gitignore
/public/mix-manifest.json
vendor.js
.gitignore
broefs's avatar

Hi @swilsdon, I did recently solve this. In my case I was referring to a table that did not yet exist in the boot method of my Auth Service Provider. No idea what could be the problem in your case.

What you could do redeploy on your local machine with an empty database and see if you can trigger the error locally that way.

wildson's avatar

Thanks for the update @broefs. In the end I was able to get things working by deleting the 'tests/utilities/functions.php' file from my site - luckily it was not vital to my site.

I suspect it was something to do with my .gitignore, but in the end I never quite got to the bottom of the problem. Anyway, working now. Thanks again for your reply.

Please or to participate in this conversation.