Magento 2 may appear many errors after installation. Follow How to fix blank admin page on Magento 2.3 in Windows to get the best fix from us!
This is the first error you will encounter when installing Magento 2.3 in Windows!. The reason for the invalid template file is the difference between the use of “/” and “\” in the path. Windows uses “/” while Magento uses “\”.
The exception dialog box will appear like this:
Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: ‘E:/Working/xampp/htdocs/magento233/vendor/magento/module-backend/view/adminhtml/templates/page/js/require_js.phtml’ in module: ‘Magento_Backend’ block’s name: ‘require.js’
To fix it, go to the Magento folder you have installed.
Next, go to vendor->magento->framework->View->Element->Template->File->Validator.php
You find the code line:
$realPath = $this->fileDriver->getRealPath($path);
Then replace to:
$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));
Note: We recommend that you keep the old code line for future use. To hide it, use “//” before the code line.
Thus, the error of the Invalid template file has been completely fixed.
Please run the deploy command :
php bin/magento setup:static-content:deploy -f