2

I have installed Magento 2.2.8 in Xampp. After installed and done all the necessary things, I have checked the site in frontend but it seems the CSS is not loaded correctly. Please see the screenshot

enter image description here

In the Network tab, I'm getting these:

enter image description here

Could anyone please help me to resolve this issue?

  • set developer mode and check if you are getting any error – Shoaib Munir May 14 at 5:07
  • run php bin/magento s:s:d -f – Saphal Jha May 14 at 5:14
  • 1
    @magefms Yes I have tried but the coding in the file which you mentioned is different in Magento 2.2.8 when compared to Magento 2.3.1 – Siva May 14 at 5:32
  • 1
    I have checked and see the network tab, it shows 404 for many of the JS files and the screenshot is attached in the question. The thing is, I have tried to install a third party theme and it was failed. I think this may the reason for this. If this is the case, how to solve this? – Siva May 14 at 6:38
0

You can give this a try, edit isPathInDirectories method with below code:

protected function isPathInDirectories($path, $directories)
    {
        if (!is_array($directories)) {
            $directories = (array)$directories;
        }
        foreach ($directories as $directory) {
            if (0 === strpos(str_replace('\\', '/',$this->fileDriver->getRealPath($path)), $directory)) {
                return true;
            }
        }
        return false;
    }

Note: don't forget to redeploy static contents and run di:compile command

  • I haven't tested it but as you mentioned in the comment above, I think the above solution will work. – fmsthird May 14 at 6:42
  • I have tried but it's not working as expected! – Siva May 14 at 6:54
  • how'd you do it? You should first run php bin/magento setup:static-content:deploy -f --area frontend then edit the Validator file. Save then run php bin/magento setup:di:compile – fmsthird May 14 at 6:56
  • because the error seems to be caused by undeployed static files as mentioned in the comment above, you should check pub/static/frontend folder if static contents has been generated after running command for deploy static view files – fmsthird May 14 at 6:58
  • 1
    Let me try and update you. Thanks for the steps – Siva May 14 at 7:07

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.