Invalid template file magento2.3.0

Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'D:/wamp64/www/mage23/vendor/magento/module-theme/view/frontend/templates/page/js/require_js.phtml' in module: '' block's name: 'require.js

This is the problem with windows. Windows uses "\" as separator, the array "directories" contains entries with "/" as separator, so the check will always fail. So you need to fix this by replacing the separator in core file:


Navigate to vendor>magento>framework>view>element>template>file>validator.php



and replace this function by below code and run deploy command


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

Comments

Popular posts from this blog

Jasper report integration in Spring boot/Spring MVC.

FireBase Crud operation in Spring Boot

Xero Developer account setup with REST API auth flow.