I have below error while I am compiling the Magento Store. it took very long time and finally gave this error.

php bin/magento setup:di:compile

enter image description here

1 Answer 1


Update setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php

if (preg_match($pattern, $fileItem->getRealPath())) {


if (preg_match($pattern, str_replace('\\', '/', $fileItem->getRealPath()))) {

Check this Link, Fixed by Magento.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.