CSS and JS not rendering from pub/static folder after installation of Magento 2.2.8
-
10-03-2021 - |
Question
I have just installed Magento 2.2.8 and it throws an error on home page
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?
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