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?

asked Aug 4, 2021 at 9:10
3
  • Sorry Magento 2.2.4 develop not 2.4 Commented Aug 4, 2021 at 9:13
  • Have you try with magento default theme? The Issue is show from theme it self. Commented Aug 4, 2021 at 9:26
  • Yes. It's on the default. Already resolved. Thank you very much. Commented 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; }
answered Aug 4, 2021 at 9:29

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.