This is known issue in Magento 2 with localhost and solution is below.
File path : vendor/magento/framework/View/Element/Template/File/Validator.php
Replace full method (function) : isPathInDirectories() and isValid()
public function isValid($filename)
{
$filename = str_replace('\\', '/', $filename);
if (!isset($this->_templatesValidationResults[$filename])) {
$this->_templatesValidationResults[$filename] =
($this->isPathInDirectories($filename, $this->_compiledDir)
|| $this->isPathInDirectories($filename, $this->moduleDirs)
|| $this->isPathInDirectories($filename, $this->_themesDir)
|| $this->_isAllowSymlinks)
&& $this->getRootDirectory()->isFile($this->getRootDirectory()->getRelativePath($filename));
}
return $this->_templatesValidationResults[$filename];
}
protected function isPathInDirectories($path, $directories)
{
if (!is_array($directories)) {
$directories = (array)$directories;
}
$realPath = $this->fileDriver->getRealPath($path);
$realPath = str_replace('\\', '/', $realPath);
foreach ($directories as $directory) {
if (0 === strpos($realPath, $directory)) {
return true;
}
}
return false;
}
If this helps you then hit like and accept as answer.
Thank you
Hiren Patel