2

I have installed a theme into my Magento store and now I want to try to switch to that theme. After installing and setting the them in the configuration through the admin panel, I get the following error when I try to visit the store:

1 exception(s):
Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: '/bitnami/magento/htdocs/app/design/frontend/Bege/bege1/Magento_Theme/templates/page/js/require_js.phtml' in module: '' block's name: 'require.js'

Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: '/bitnami/magento/htdocs/app/design/frontend/Bege/bege1/Magento_Theme/templates/page/js/require_js.phtml' in module: '' block's name: 'require.js'
#0 /opt/bitnami/magento/htdocs/vendor/magento/framework/View/Element/Template.php(300): Magento\Framework\View\Element\Template->fetchView('/bitnami/magent...')
#1 /opt/bitnami/magento/htdocs/vendor/magento/framework/View/Element/AbstractBlock.php(667): Magento\Framework\View\Element\Template->_toHtml()
#2 /opt/bitnami/magento/htdocs/vendor/magento/framework/View/Result/Page.php(248): Magento\Framework\View\Element\AbstractBlock->toHtml()
#3 /opt/bitnami/magento/htdocs/vendor/magento/framework/View/Result/Layout.php(170): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor))
#4 /opt/bitnami/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#5 /opt/bitnami/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Result\Page\Interceptor->___callParent('renderResult', Array)
#6 /opt/bitnami/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Response\Http\Interceptor))
#7 /opt/bitnami/magento/htdocs/generated/code/Magento/Framework/View/Result/Page/Interceptor.php(26): Magento\Framework\View\Result\Page\Interceptor->___callPlugins('renderResult', Array, Array)
#8 /opt/bitnami/magento/htdocs/vendor/magento/framework/App/Http.php(139): Magento\Framework\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#9 /opt/bitnami/magento/htdocs/vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http->launch()
#10 /opt/bitnami/magento/htdocs/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#11 {main}

I already checked permission, path and they both seems to be correct. The content of require_js.phtm is as follow:

<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
?>
<script>
    var require = {
        "baseUrl": "<?php /* @escapeNotVerified */ echo $block->getViewFileUrl('/'); ?>"
    };
</script>

It seems valid php to me.

Am I missing something?

1 Answer 1

0

Please try with below code its working for me :

vendor/magento/framework/view/element/template/file/validator.php with this.

protected function isPathInDirectories($path, $directories)
{
    $realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));
    if (!is_array($directories)) {
        $directories = (array)$directories;
    }

    foreach ($directories as $directory) {
        if (0 === strpos($realPath, $directory)) {
            return true;
        }
    }
    return false;
}

and than now reload the magento application.

hope its work for you

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.