Solving the PluginListGenerator.php Error in Magento 2
Error occurs while running the command “bin/magento setup:di:compile”
it is very hectic when all good goin code stops due to unknown issues,
One of this issue is “file not found” during compile the setup of magento 2
If you’ve ever encountered the frustrating file_put_contents error while working with Magento 2, you’re not alone. This common issue occurs during the setup:di:compile command, and the error looks something like this:
file_put_contents(~/mag246/generated/metadata/primary|global|plugin-list.php): failed to open stream: No such file or directory in mag246\vendor\magento\framework\Interception\PluginListGenerator.php
Here’s a step-by-step solution to fix this error quickly and easily.
- Open
PluginListGenerator.phplocated atvendor/magento/framework/Interception.- ~/vendor/magento/framework/Interception/PluginListGenerator.php
- ~/vendor/magento/framework/Interception/PluginListGenerator.php
- find function
public function write(array $scopes): voidat line no148 - find line no
156OR line given bellow$cacheId = implode('|', $this->scopePriorityScheme) . "|" . $this->cacheId;- and replace with
$cacheId = implode('-', $this->scopePriorityScheme) . "-" . $this->cacheId;
- Save the file and run
bin/magento setup:di:compile. - bin/magento c:c
That’s it.
$cacheId = implode('|', $this->scopePriorityScheme) . "|" . $this->cacheId;
Change with
$cacheId = implode('-', $this->scopePriorityScheme) . "-" . $this->cacheId;
