Magento 2How To GuideApril 22, 2024

Fixed: Magento 2 vendor autoload is not found. please run 'composer install' under application root directory.

Fixed: Magento 2 vendor autoload is not found. please run 'composer install' under application root directory.

Magento is without a doubt one of the most powerful and widely used eCommerce platforms. However, like any other platform, it can run into issues from time to time. One common issue that you are bound to encounter is the vendor autoload is not found. This issue can be quite frustrating even for expert Magento developers. This article will let you know everything there is to know about the issue and how to fix it.

Understanding ‘Vendor Autoload is not Found Magento 2’

It is pertinent to understand why this occurs in the first place. Magento 2 displays this error when it is unable to locate the necessary autoload files in the vendor directory. For those of you who don’t know, the vendor directory is where Magento installs all third-party components. If Magento cannot locate the necessary files in this directory, it is near impossible for the platform to function smoothly.

What Causes ‘Vendor Autoload is not Found’?

There are several reasons contributing to the vendor autoload is not found error. The most likely reason is the composer installation process did not complete properly. You may have unknowingly interrupted the process, leading to missing files in the directory. Secondly, you may not have granted Magento permission to access the relevant files. Check your file permissions to ensure that the platform has relevant access. Problems with the composer cache can also contribute to the issue.

Fixing the Magento 2 Vendor Autoload is not Found Error

This error can pop up when you try to install Magento 2 on your server or create a Magento 2 instance on your local machine. The following steps will fix the error.

  • Open command prompt and type cd\
  • Navigate to your Magento 2 root directory i.e. where you have kept your Magento 2 installation files.
Example: cd xampp/htdocs/magento 2
  • Type the command ‘composer install’.

Example: xampp/htdocs/magento 2/composer install

This will import your packages and create the vendor folder, along with the autoload script. It will take a minimum 20 minutes to do this. So just relax.

  • When the download completes, refresh the browser and you will see the error has gone.

If you are getting the above error on your server, run the command ‘composer install’ on your server after navigating to the root directory.

A common issue that people face is they can't use composer because they can't run it on their server (e.g. because it's shared and they have no shell access). In that case, you can still use composer. Run ‘composer install’ locally (an environment that has no such restrictions) and upload the local vendor folder it generates along with all your other PHP scripts.

Hope it resolves the issue.

Conclusion

That’s it for this tutorial. If you have any Magento related queries, then ask our expert Magento support team.

Related Articles: