zoukankan      html  css  js  c++  java
  • Magento2-2.3.4 windows安装完magento无法加载静态资源导致无法进入后台登录页面

    后台面无法进入,截图如下

    首先查看var/log/system.log日志文件,发现报错信息如下

    RROR: Error: Application is not installed yet.  [] []
    [2020-03-25 00:16:08] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
    [2020-03-25 00:53:11] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
    [2020-03-25 12:27:55] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
    [2020-03-25 12:39:38] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
    [2020-03-25 12:42:31] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
    [2020-03-25 12:56:42] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
    [2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Backend/view/adminhtml/templates/page/js/require_js.phtml' in module: 'Magento_Backend' block's name: 'require.js' [] []
    [2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Translation/view/base/templates/translate.phtml' in module: 'Magento_Translation' block's name: 'translate' [] []
    [2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Backend/view/adminhtml/templates/page/js/components.phtml' in module: '' block's name: 'head.components' [] []
    [2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml' in module: '' block's name: 'head.calendar' [] []
    [2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Cookie/view/base/templates/html/cookie.phtml' in module: '' block's name: 'cookie_config' [] []
    [2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Ui/view/base/templates/logger.phtml' in module: 'Magento_Ui' block's name: 'logger' [] []
    [2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Ui/view/base/templates/wysiwyg/active_editor.phtml' in module: 'Magento_Ui' block's name: 'theme.active.editor' [] []
    [2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml' in module: 'Magento_Backend' block's name: 'logo' [] []

    解决方法

    找到libinternalMagentoFrameworkViewElementTemplateFileValidator.php文件中的isPathInDirectories方法

    $realPath = str_replace('\', '/', $this->fileDriver->getRealPath($path));替换$realPath = $this->fileDriver->getRealPath($path);

    看结果

    如果还是不行,可以尝试如下操作

    INSERT INTO core_config_data (path, value) VALUES ('dev/static/sign', 0) ON DUPLICATE KEY UPDATE value = 0;

    php bin/magento cache:clean

    如果登录页面可以打开,但是图片和CSS报404,可以执行正面命令

    sudo php bin/magento setup:static-content:deploy -f
    sudo php bin/magento cache:flush

    如果登录页面打不开只显示No input file specified.

    请检查 var/cache缓存目录是否有写入权限,如果没有执行正面命令

    sudo chmod 777 var/cache -R

     如果登录页面打不开,然后exception报class not exist,执行正面命令

    sudo php bin/magento setup:di:compile
    sudo php bin/magento cache:flush
  • 相关阅读:
    python学习第四天 --字符编码 与格式化及其字符串切片
    Lambda表达式 之 C#
    python学习第三天 --布尔类型
    深入理解正则表达式
    《你不知道的JavaScript》第一部分:作用域和闭包
    jquery的extend和fn.extend
    HttpModule与HttpHandler详解
    jQuery分析(2)
    jQuery分析(1)
    jQuery源码中的“new jQuery.fn.init()”什么意思?
  • 原文地址:https://www.cnblogs.com/IT-Crowd/p/12571611.html
Copyright © 2011-2022 走看看