"vendor" folder missing after running "Composer Install"

"vendor" folder missing after running "Composer Install"

  1. Blog
  2. 15 November 2026
  3. 5 min read

Stefan Bogdanescu

Founder & Senior Architect

"vendor" folder missing after running "Composer Install"

If you are deploying a Laravel application pulled from GitHub and immediately hit a require(/.../public/vendor/autoload.php) error, the root cause is almost certainly that Composer did not actually install the dependencies into your project directory. In many modern environments, this happens because Composer detects an existing installation in the wrong location or fails to initialize a fresh install on a new machine.

The error message explicitly points to public/vendor/autoload.php. This tells us two critical things: first, Laravel expects its autoloader to be inside the vendor directory at the root of your application (usually /home/vagrant/.../). Second, the fact that the file is missing means Composer either skipped creation or wrote to a different path.

Understanding the "Nothing to install or update" Warning

Your terminal output shows:

Installing dependencies (including require-dev) from lock file
Nothing to install or update

This message often misleads developers into thinking everything is fine. However, when combined with the absence of the vendor folder, it indicates that Composer is reading a composer.lock file generated on another machine (likely where the code was cloned) and finding the directory structure already "complete" from its perspective, yet physically empty or misplaced on your new server.

If you are working with Laravel 4, as noted in the source material, you are dealing with an older version of the framework. While modern Laravel versions handle autoloading robustly, legacy projects can be sensitive to where Composer places files. The output also lists several abandoned packages (herrera-io/json, mjolnic/bootstrap-colorpicker, etc.). These warnings confirm that Composer did run, but it is using an outdated lock file that expects a specific directory structure which hasn't been created yet on your Homestead or Vagrant box.

The Root Cause: Path Resolution and Symlinks

In a standard Laravel installation, the vendor folder belongs in the root of the project, not inside the public folder. The error failed to open stream: No such file or directory in .../public/autoload.php on line 2 occurs because your application's entry point is trying to load an autoloader that lives one level up.

If you ran composer install while inside a subdirectory, or if the project was symlinked incorrectly, Composer might have created the folder in the wrong place. More commonly with GitHub repositories pulled directly onto a server:

  1. The .git folder contains a vendor/ directory from your local machine (if you had one).
  2. Or, more likely in this specific case, Composer simply failed to create the directory structure because the composer.lock file implies packages are already present, but they aren't.

How to Fix It

To resolve this, you must force Composer to ignore existing lock files or ensure it creates the directories from scratch.

Step 1: Verify the Project Root
Ensure you are running commands from the actual root of the Laravel application, not inside public or a subfolder. Navigate to the project root:

cd /home/vagrant/... # Replace with your actual project path
ls -la

You should see composer.json, composer.lock, and app.

Step 2: Force a Fresh Install
Since the output says "Nothing to install or update," you need to bypass the lock file temporarily to ensure packages are downloaded. Run:

composer dump-autoload --optimize

If that fails to create the folder, try removing any existing vendor directory manually if it exists but is empty, then run:

rm -rf vendor
composer install --no-dev

The --no-dev flag is crucial here. The source material shows require-dev packages were being processed. In production environments (like Homestead serving traffic), you generally do not want development dependencies installed, which can sometimes cause path conflicts if the lock file expects them to be in a specific spot that doesn't match your current setup.

Step 3: Check for Symlink Issues
If you cloned the repository from a local machine where vendor existed, Git might have ignored it. Ensure .gitignore is not accidentally ignoring the vendor folder on your server. If you are using Vagrant/Homestead, ensure the shared folders are mounted correctly. Sometimes, if the local clone had a vendor folder and the remote did not, Git might skip syncing it, but Composer should still generate it. If the lock file expects a specific version of a package that isn't in your global composer cache, you may need to clear the cache:

composer clear-cache

Legacy Considerations for Laravel 4

The abandoned packages mentioned in your log are a significant red flag for security and stability. Laravel 4 is end-of-life. While fixing the vendor folder issue will get the application running, relying on herrera-io/json or kherge/version introduces security vulnerabilities and prevents you from receiving updates.

Once the autoloader is generating correctly, you should run:

php artisan optimize

This generates an optimized class loader file in bootstrap/cache, which speeds up execution but requires the vendor folder to be present first. If this step fails because the folder is missing, you have confirmed the installation issue persists until a fresh composer install creates the directory structure.

For modern Laravel projects (5.x and above), this specific error is rare due to better default behaviors in Composer, but understanding the distinction between composer.lock expectations and actual filesystem state remains vital for any deployment workflow. If you are maintaining an older Laravel 4 project on a new server, always ensure you are running composer install in the root directory, not within public, to avoid path confusion in your autoloader configuration.

Our network