Apart from the above error, we also see below error while doing a setup in local.
1 exception(s): Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: templates/page/js/require_js.phtml' in module: 'Magento_Backend' block's name: 'require.js'
Solution
Give proper permission chmod -R 777 MAGENTO_2_ROOT_DIRECTORY/
php bin/magento setup:static-content:deploy
rm -rf var/* except .htaccess
Enable apache rewrite_moduleOptions Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
Change the above foreach
loop to run our Magento with no further issues on this:
#/vendor/magento/framework/View/Element/Template/File/Validator.php:139 foreach ($directories as $directory) { // Add this line $realDirectory = $this->fileDriver->getRealPath($directory); // and replace `$directory` with `$realDirectory` if (0 === strpos($realPath, $realDirectory)) { return true; } }
INSERT INTO core_config_data (config_id, scope, scope_id, path, value, updated_at) VALUES (NULL, 'default', '0', 'dev/static/sign', '0', current_timestamp());
I Hope, you are able to fix the error for now 🙂