How To

[Error Solved] Magento 2: Failed to open stream: No such file or directory in composer autoload_real.php

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.

Introduction:

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.

How to Fix Failed to open stream: No such file or directory in composer autoload_real.php Error in Magento 2?

You just need to run the below command in the Magento root directory

composer dumpautoload

Conclusion:

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!

Click to rate this post!
[Total: 12 Average: 4.7]
Dhiren Vasoya

Dhiren Vasoya is a Director and Co-founder at MageComp, Passionate 🎖️ Certified Magento Developer👨‍💻. He has more than 9 years of experience in Magento Development and completed 850+ projects to solve the most important E-commerce challenges. He is fond❤️ of coding and if he is not busy developing then you can find him at the cricket ground, hitting boundaries.🏏

Recent Posts

What are Net Sales? How to Calculate Your Net Sales?

In the world of business, understanding financial metrics is crucial for making informed decisions and…

2 days ago

Magento 2 Extensions Digest April 2024 (New Release & Updates)

Welcome to the MageComp Monthly Digest, where we bring you the latest updates, releases, and…

2 days ago

The ABCs of Geofencing: Definition, Features and Uses

In this era, businesses are always on the lookout for ways to engage with their…

3 days ago

How to Delete Product Variant in a Shopify Remix App using GraphQL Mutations?

Managing a Shopify store efficiently involves keeping your product catalog organized. This includes removing outdated…

4 days ago

6 Innovative Tools Revolutionizing E-Commerce Operations

E-commerce has transformed the way consumers shop for products and services and interact with businesses.…

6 days ago

How Upcoming Cookie Changes Will Affect Your E-commerce Website?

The e-commerce world is constantly in flux. New tech and strategies emerge daily to help…

6 days ago