I have just installed Magento 2.2.8 and it throws an error on home page

magento 2 homepage error

then I ran following commands

php -dmemory_limit=6G bin/magento setup:static-content:deploy -f
php bin/magento cache:clean

But its nothing changed how to solved this error? why Magento 2.2.8 does not taking pub/static path for images,css and js files?

  • Its looks like a permissions issue. Have you tried giving permission to var/, pub/? – Muzammal Hassan Aug 20 at 9:18
  • I have installed magento in local. you can check screenshot – Niraj Patel Aug 20 at 9:19
  • there is no need to run chmod command because my magento installed in xampp windows OS in local computer. I did not installed on server – Niraj Patel Aug 20 at 9:21
  • This may be a issue because of .htaccess file. Please check if there is .htaccess file under pub/static or not. – temper Aug 20 at 9:36
  • or try to rename .htaccess file from your magento rot directory then check if it works. – temper Aug 20 at 9:37

Around line 133 find function isPathInDirectories


$realPath = str_replace('\\', '/', $realPath); // extra code added


protected function isPathInDirectories($path, $directories)
        if (!is_array($directories)) {
            $directories = (array)$directories;
        $realPath = $this->fileDriver->getRealPath($path);
        $realPath = str_replace('\\', '/', $realPath); // extra code added
        foreach ($directories as $directory) {
            if (0 === strpos($realPath, $directory)) {
                return true;
        return false;
  • Awesome bro,it works fine,appreciated – Niraj Patel Aug 20 at 9:31
  • @NirajPatel Thanks brother – Savan Patel Aug 20 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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