Hello Magento Geeks,
I am back to solve another error you might be facing in Magento 2. Today it’s about the “Failed to open stream: No such file or directory in composer autoload_real.php” error in Magento 2. Before this, I also shared the solution for PHP Fatal Error “Call to Undefined Function str_contains()” After Upgrading to Magento 2.4.x – Click Here to solve
While working on projects, our developer came across an error and tried resolving it. With serious efforts, they finally solved the error. Hence, we decided to share with you all so that it becomes easy if you come across this error in the future. Let’s know more about the composer autoload error.
Contents
When we run the below command in the terminal for uninstalling a module via composer,
php bin/magento module:uninstall Vendor_Extension --clear-static-content
The following error appeared in the terminal as well as localhost,
Warning: require(/var/www/html/M243/vendor/composer/../magento/module-contact/registration.php): failed to open stream: No such file or directory in /var/www/html/M243/vendor/composer/autoload_real.php on line 73
Fatal error: require(): Failed opening required ‘/var/www/html/M243/vendor/composer/../magento/module-contact/registration.php’ (include_path=’/var/www/html/M243/vendor/magento/zendframework1/library:.:/usr/share/php’) in /var/www/html/M243/vendor/composer/autoload_real.php on line 73
Error on site
Error on terminal
So let us know how we fixed this error.
You just need to run the below command in the Magento root directory
composer dumpautoload
Very simple, right? This way you can solve the “Failed to open stream: No such file or directory in composer autoload_real.php” error in Magento 2. Let me know if the error still persists. If you face any other errors while working with Magento 2, reach out to our Experienced Magento Developers.
Share the article with your other Magento friends and stay in touch with us for more instructive guides on Magento.
Happy Coding!
In the world of business, understanding financial metrics is crucial for making informed decisions and…
Welcome to the MageComp Monthly Digest, where we bring you the latest updates, releases, and…
In this era, businesses are always on the lookout for ways to engage with their…
Managing a Shopify store efficiently involves keeping your product catalog organized. This includes removing outdated…
E-commerce has transformed the way consumers shop for products and services and interact with businesses.…
The e-commerce world is constantly in flux. New tech and strategies emerge daily to help…