3
votes

I am currently trying to run on Vagrant/Homestead a Laravel Application that I pulled from Github. I connected it to the database, and run Composer Install, Composer Update inside the folder. When I try to access to it on the Browser I get the following error:

Warning: require(/home/vagrant/.../public/vendor/autoload.php): failed to open stream: No such file or directory in /home/vagrant/..../public/autoload.php on line 2

I navigated to the vendor folder and noticed that it was not created. Any ideas how to fix it?

The application runs in Laravel 4, and I got the following output from the terminal when I run Composer Install:

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Package herrera-io/json is abandoned, you should avoid using it. Use kherge/json instead.
Package kherge/version is abandoned, you should avoid using it. No replacement was suggested.
Package herrera-io/phar-update is abandoned, you should avoid using it. No replacement was suggested.
Package mjolnic/bootstrap-colorpicker is abandoned, you should avoid using it. Use itsjavi/bootstrap-colorpicker instead.

Generating autoload files

php artisan clear-compiled php artisan optimize Generating optimized class loader

Any ideas?

3
have you tried composer install --no-scripts - pseudoanime
I just did, and got the same error while trying to access to the application on the browser. - Carlo Teran
Do you get any errors in the command line while running composer install? - Nathan Heffley
I don't get any errors. The output of the terminal when I run composer install is on the question. This is an old Application running on Laravel 4 that I need to test locally using Homestead. Maybe outdated packages are causing the problem? - Carlo Teran

3 Answers

1
votes

Composer needs to be run from the root of your application, i.e. not from the public folder as your error seems to indicate.

You can first try running:

composer install --no-scripts

This command should list the packages that are being downloaded and installed. If the above works, you can then run:

php artisan optimize

This will create the autoload.php file that Laravel will use.

0
votes

I also experienced that, i solved the problem by creating a vendor/bin folder inside the Composer directory.

$PATH/users/*-system_name-*/AppData/Roaming/Composer 
-1
votes

I got the same problem, some answer are valid but didnt help then i tried a command = composer dump-autoload. Then it works fine. HOPE this helps you the best.