0

I have installed Magento 2.4 on xampp and I have this error:

1 exception(s):
Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'D:/xampp/htdocs/magento2/app/code/Magento/Theme/view/frontend/templates/page/js/require_js.phtml' in module: '' block's name: 'require.js'

Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'D:/xampp/htdocs/magento2/app/code/Magento/Theme/view/frontend/templates/page/js/require_js.phtml' in module: '' block's name: 'require.js'
<pre>#1 Magento\Framework\View\Element\Template->_toHtml() called at [lib\internal\Magento\Framework\View\Element\AbstractBlock.php:1114]
#2 Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}() called at [lib\internal\Magento\Framework\View\Element\AbstractBlock.php:1118]
#3 Magento\Framework\View\Element\AbstractBlock->_loadCache() called at [lib\internal\Magento\Framework\View\Element\AbstractBlock.php:678]
#4 Magento\Framework\View\Element\AbstractBlock->toHtml() called at [lib\internal\Magento\Framework\View\Result\Page.php:251]
#5 Magento\Framework\View\Result\Page->render() called at [lib\internal\Magento\Framework\View\Result\Layout.php:171]
#6 Magento\Framework\View\Result\Layout->renderResult() called at [lib\internal\Magento\Framework\Interception\Interceptor.php:58]
#7 Magento\Framework\View\Result\Page\Interceptor->___callParent() called at [lib\internal\Magento\Framework\Interception\Interceptor.php:138]
#8 Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}() called at [lib\internal\Magento\Framework\Interception\Interceptor.php:153]
#9 Magento\Framework\View\Result\Page\Interceptor->___callPlugins() called at [generated\code\Magento\Framework\View\Result\Page\Interceptor.php:95]
#10 Magento\Framework\View\Result\Page\Interceptor->renderResult() called at [lib\internal\Magento\Framework\App\Http.php:120]
#11 Magento\Framework\App\Http->launch() called at [generated\code\Magento\Framework\App\Http\Interceptor.php:23]
#12 Magento\Framework\App\Http\Interceptor->launch() called at [lib\internal\Magento\Framework\App\Bootstrap.php:264]
#13 Magento\Framework\App\Bootstrap->run() called at [index.php:30]
</pre>

The solutions found are of no use.

Someone can help?

3
  • Sorry Magento 2.2.4 develop not 2.4 Aug 4, 2021 at 9:13
  • Have you try with magento default theme? The Issue is show from theme it self. Aug 4, 2021 at 9:26
  • Yes. It's on the default. Already resolved. Thank you very much. Aug 4, 2021 at 9:30

1 Answer 1

0

Solved Need to change in function:

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; }

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.