You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Chrome中phpMyAdmin查询MySQL表时出现CodeMirror.runMode函数错误

phpMyAdmin Chrome下SQL高亮报错:CodeMirror.runMode is not a function

自上周起,在Chrome 114.0.0.0浏览器中使用phpMyAdmin 5.2.1查看MySQL表时,每次查询都会弹出TypeError: CodeMirror.runMode is not a function错误。尝试多个不同的phpMyAdmin实例后问题依旧,需排查是部署问题还是普遍兼容性问题。

完整错误信息

{"pma_version": "5.2.1","browser_name": "CHROME","browser_version": "114.0.0.0","user_os": "Win","server_software": "nginx/1.18.0","user_agent_string": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36","locale": "en","configuration_storage": "disabled","php_version": "8.1.20","script_name": "index.php","exception_type": "js","exception": {"mode": "stack","name": "TypeError","message": "CodeMirror.runMode is not a function","stack": [{"func": "HTMLElement.<anonymous>","line": "1623","column": "20","context": ["    /* We only care about visible elements to avoid double processing */","    if ($pre.is(':visible')) {","      var $highlight = $('<div class=\"sql-highlight cm-s-default\"></div>');","      $sql.append($highlight);","      if (typeof CodeMirror !== 'undefined') {","        CodeMirror.runMode($sql.text(), 'text/x-mysql', $highlight[0]);","        $pre.hide();","        $highlight.find('.cm-keyword').each(Functions.documentationKeyword);","        $highlight.find('.cm-builtin').each(Functions.documentationBuiltin);","      }","    }"],"uri": "js/dist/functions.js?v=5.2.1","scriptname": "js/dist/functions.js"},{"func": "Function.each","line": "2","column": "3003","context": ["/*! jQuery v3.6.3 | (c) OpenJS Foundation and other contributors | jquery.o//...","!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof modul//...",""],"uri": "js/vendor/jquery/jquery.min.js?v=5.2.1","scriptname": "js/vendor/jquery/jquery.min.js"},{"func": "e.<computed>.each","line": "2","column": "1481","context": ["/*! jQuery v3.6.3 | (c) OpenJS Foundation and other contributors | jquery.o//...","!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof modul//...",""],"uri": "js/vendor/jquery/jquery.min.js?v=5.2.1","scriptname": "js/vendor/jquery/jquery.min.js"},{"func": "Functions.highlightSql","line": "1615","column": "8","context": [" *"," * @param $base"," */","Functions.highlightSql = function ($base) {","  var $elm = $base.find('code.sql');","  $elm.each(function () {","    var $sql = $(this);","    var $pre = $sql.find('pre');","    /* We only care about visible elements to avoid double processing */","    if ($pre.is(':visible')) {","      var $highlight = $('<div class=\"sql-highlight cm-s-default\"></div>')"],"uri": "js/dist/functions.js?v=5.2.1","scriptname": "js/dist/functions.js"},{"func": "?","line": "495","column": "21","context": ["        // been added outside of #page_content","        $('body').children().not('div.modal').not('#pma_navigation').not('#//...","        // Replace #page_content with new content","        if (data.message && data.message.length > 0) {","          $('#page_content').replaceWith('<div id=\\'page_content\\'>' + data//...","          Functions.highlightSql($('#page_content'));","          Functions.checkNumberOfFields();","        }","        if (data.selflink) {","          var source = data.selflink.split('?')[0];","          // Check for faulty links"],"uri": "js/dist/ajax.js?v=5.2.1","scriptname": "js/dist/ajax.js"},{"func": "Object.reset","line": "745","column": "7","context": ["       * Re-attach a generic event handler to clicks","       * on pages and submissions of forms","       */","      $(document).off('click', 'a').on('click', 'a', AJAX.requestHandler);","      $(document).off('submit', 'form').on('submit', 'form', AJAX.requestHa//...","      callback();","    }","  }","};","","/**"],"uri": "js/dist/ajax.js?v=5.2.1","scriptname": "js/dist/ajax.js"},{"func": "Object.responseHandler [as success]","line": "468","column": "26","context": ["        Functions.ajaxShowMessage(data.redirect, false);","        AJAX.active = false;","        AJAX.xhr = null;","        return;","      }","      AJAX.scriptHandler.reset(function () {","        if (data.reloadNavigation) {","          Navigation.reload();","        }","        if (data.title) {","          $('title').replaceWith(data.title);"],"uri": "js/dist/ajax.js?v=5.2.1","scriptname": "js/dist/ajax.js"},{"func": "c","line": "2","column": "28599","context": ["/*! jQuery v3.6.3 | (c) OpenJS Foundation and other contributors | jquery.o//...","!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof modul//...",""],"uri": "js/vendor/jquery/jquery.min.js?v=5.2.1","scriptname": "js/vendor/jquery/jquery.min.js"},{"func": "Object.fireWith [as resolveWith]","line": "2","column": "29344","context": ["/*! jQuery v3.6.3 | (c) OpenJS Foundation and other contributors | jquery.o//...","!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof modul//...",""],"uri": "js/vendor/jquery/jquery.min.js?v=5.2.1","scriptname": "js/vendor/jquery/jquery.min.js"},{"func": "l","line": "2","column": "80328","context": ["/*! jQuery v3.6.3 | (c) OpenJS Foundation and other contributors | jquery.o//...","!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof modul//...",""],"uri": "js/vendor/jquery/jquery.min.js?v=5.2.1","scriptname": "js/vendor/jquery/jquery.min.js"}],"uri": "index.php?route=%2Fsql&pos=0"}}

排查与解决步骤

  • 清除浏览器缓存:Chrome中按Ctrl+Shift+Delete,勾选「缓存的图片和文件」,选择「过去7天」后清除,重启浏览器重试。
  • 禁用浏览器扩展:暂时禁用所有Chrome扩展(尤其是广告拦截、脚本修改类),逐个排查是否有扩展干扰CodeMirror加载。
  • 版本兼容性调整:phpMyAdmin 5.2.1与Chrome 114可能存在兼容性问题,尝试升级到最新稳定版,或降级到5.1.x版本测试。
  • 检查依赖完整性:确认phpMyAdmin的js/vendor/codemirror目录下文件完整,若缺失则重新部署phpMyAdmin。
  • 跨浏览器验证:用Firefox、Edge等其他浏览器操作,验证是否仅Chrome下出现问题,缩小排查范围。

内容的提问来源于stack exchange,提问作者Luis Garcia

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.17 15:57:26