Magento 2 is a preferable choice for E-commerce stores serving the global customer base, owing to the flexibility and customization options.
However, sometimes the developers face errors while migrating, upgrading, customizing or performing any operations on the Magento 2 store.
One of them is failed to open stream error while compiling PluginListGenerator.php in Magento 2.4.1 that says,
file_put_contents(C:/xampp/htdocs/Yash/mag241sample/generated/metadata/primary|global|plugin-list.php): failed to open stream: No such file or directory in C:\xampp\htdocs\Yash\mag241sample\vendor\magento\framework\Interception\PluginListGenerator.php on line 414
You may face this error while running the command “bin/magento setup:di:compile” in Magento 2.4.1 using XAMPP.
This error may also occur after upgrading your Magento 2 from an older version to Magento 2.4.1.
Check the solution for the same below:
Solution for Failed to Open Stream Error While Compiling PluginListGenerator.php in Magento 2.4.1
- Open PluginListGenerator.php file located at vendor/magento/framework/Interception.
- Go to line 414 or find the word “scopePriorityScheme” in PluginListGenerator.php file.
- Replace the linewith below:1$cacheId = implode('|', $this->scopePriorityScheme) . "|" . $this->cacheId;1$cacheId = implode('-', $this->scopePriorityScheme) . "-" . $this->cacheId;
- Save the PluginListGenerator.php file.
Now your “bin/magento setup:di:compile” command will run successfully without any error.
If you have any question regarding this error or its solution, feel free to mention them in the Comments section below.
I’m here to help you out.
Do share the solution with Magento Community via social media.
Get Weekly Updates
Never miss Magento tips, tricks, tutorials, and news.
Thank you for subscribing.
Something went wrong.