Search code examples
phplaravelhomestead

"vendor" folder missing after running "Composer Install"


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?


Solution

  • 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.