magento 2.4 The requested class did not generate properly, because the 'generated' directory permission is read-only code example
Example: magento 2 The requested class did not generate properly, because the 'generated' directory permission is read-only
sudo chown -R youruser:www-data /generated