cancel
Showing results for 
Search instead for 
Did you mean: 

Class "Pelago\Emogrifier" does not exist | PHP 8.2 Magento CLI 2.4.6

Class "Pelago\Emogrifier" does not exist | PHP 8.2 Magento CLI 2.4.6

Was trying to update M 2.3.2 (PHP 7,2) to M2.4.6 (PHP 8,2)

And got this error

 

Class "Pelago\Emogrifier" does not exist
Class Company\Module\Model\Template\Filter\Interceptor generation error: The requested class did not generate p
roperly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' C
LI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then
you must add the generated class object to the signature of the related construct method, only.

 

This is the only module that kinda screws up the di:compile but on M 2.3.2 (PHP 7,2) everything runs smoothly

 

Already added permission(s), removed generated folder upgraded Pelago/emogrifier versions, made comparisons, also removed line breaks on the di.xml and ran with code sniffer as well

 

vendor/bin/phpcs --standard=Magento2 ..... app/code/Company/module

 

also removed line breaks on di.xml as suggested by https://github.com/magento/magento2/issues/32296

 

I also posted same issue on https://community.magento.com/t5/Installing-Magento-2-x/Permissions-error-in-2-3/td-p/123680 but I think this will get more attention as separate concern/topic. Thanks!

 

1)works fine M 2.3.2 (PHP 7,2)

"require": {

"pelago/emogrifier": "^2.0.0",
"php": "~7.1.3||~7.2.0",

 

2)Gives that generation class error on M2.4.6 (PHP 8,2)

"pelago/emogrifier": "^7.0",
"php": "~8.1.0||~8.2.0",

 

Class "Pelago\Emogrifier" does not exist
Class Company\Module\Model\Template\Filter\Interceptor generation error: The requested class did not generate p
roperly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' C
LI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then
you must add the generated class object to the signature of the related construct method, only.

 

1 REPLY 1

Re: Class "Pelago\Emogrifier" does not exist | PHP 8.2 Magento CLI 2.4.6

Hello @stillearningm2 

 

Check if the Pelago\Emogrifier library is installed

 

Pelago\Emogrifier is a third-party library that Magento 2 uses to handle CSS-to-HTML emogrification (embedding CSS directly into HTML). Ensure that the required package is installed. 

composer require pelago/emogrifier

Ensure Correct Autoloading

composer dump-autoload 
php bin/magento cache:flush 
php bin/magento setup:di:compile

Check for Namespace or Class Typos

Ensure that the class Pelago\Emogrifier is being referenced with the correct namespace. 

 

Check the Module's di.xml for Correct Interceptor Configuration

If this is related to a custom module, check the di.xml for the configuration of the interceptor (Company\Module\Model\Template\Filter\Interceptor).

 

Hope it helps !

If you find our reply helpful, please give us kudos.

 

A Leading Magento Development Agency That Delivers Powerful Results, Innovation, and Secure Digital Transformation.

 

WebDesk Solution Support Team

Get a Free Quote | | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789

 

 

 

 

Thank You,


WebDesk Solution Support Team
Get a Free Quote | Email | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789


Location: 150 King St. W. Toronto, ON M5H 1J9