Question

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?

Was it helpful?

Solution

\vendor\magento\framework\View\Element\Template\File\Validator.php

Around line 133 find function isPathInDirectories

add

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

like

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;
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top