环境
节点版本 (node -v
)
v10.13.0
插件版本 (npm ls --depth 0
)
hexo-site@0.0.0 D:\WorkspaceIdea\blog
+-- hexo@3.8.0
+-- hexo-deployer-git@0.3.1
+-- hexo-generator-archive@0.1.5
+-- hexo-generator-category@0.1.3
+-- hexo-generator-index@0.2.1
+-- hexo-generator-json-content@3.0.1
+-- hexo-generator-tag@0.2.0
+-- hexo-renderer-ejs@0.3.1
+-- hexo-renderer-marked@0.3.2
+-- hexo-renderer-stylus@0.3.3
+-- hexo-server@0.3.3
`-- hexo-wordcount@6.0.1
错误信息
Bug信息 (hexo s
)
INFO Start processing
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
TypeError: Cannot set property 'lastIndex' of undefined
at highlight (D:\blog\node_modules\highlight.js\lib\highlight.js:523:35)
at D:\blog\node_modules\highlight.js\lib\highlight.js:573:21
at Array.forEach (<anonymous>)
at Object.highlightAuto (D:\blog\node_modules\highlight.js\lib\highlight.js:572:62)
at D:\blog\node_modules\hexo-util\lib\highlight.js:117:25
at highlight (D:\blog\node_modules\hexo-util\lib\highlight.js:120:7)
at highlightUtil (D:\blog\node_modules\hexo-util\lib\highlight.js:22:14)
at data.content.data.content.replace (D:\blog\node_modules\hexo\lib\plugins\filter\before_post_render\backtick_code_block.js:59:15)
at String.replace (<anonymous>)
at Hexo.backtickCodeBlock (D:\blog\node_modules\hexo\lib\plugins\filter\before_post_render\backtick_code_block.js:14:31)
at Hexo.tryCatcher (D:\blog\node_modules\bluebird\js\release\util.js:16:23)
at Hexo.<anonymous> (D:\blog\node_modules\bluebird\js\release\method.js:15:34)
at Promise.each.filter (D:\blog\node_modules\hexo\lib\extend\filter.js:63:65)
at tryCatcher (D:\blog\node_modules\bluebird\js\release\util.js:16:23)
at Object.gotValue (D:\blog\node_modules\bluebird\js\release\reduce.js:155:18)
at Object.gotAccum (D:\blog\node_modules\bluebird\js\release\reduce.js:144:25)
at Object.tryCatcher (D:\blog\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (D:\blog\node_modules\bluebird\js\release\promise.js:512:31)
at Promise._settlePromise (D:\blog\node_modules\bluebird\js\release\promise.js:569:18)
at Promise._settlePromiseCtx (D:\blog\node_modules\bluebird\js\release\promise.js:606:10)
at _drainQueueStep (D:\blog\node_modules\bluebird\js\release\async.js:142:12)
at _drainQueue (D:\blog\node_modules\bluebird\js\release\async.js:131:9)
错误原因:
auto_detect设置为自动检测语言,github源码地址使用说明:https://github.com/hexojs/hexo-util#highlightstr-options
我认为问题是由highlight.js尝试检测代码语言引起的。
解决办法:
在_config.yml
中设置auto_detect:false
为我解决了这个问题:
打开_config.yml文件,修改如下配置:
highlight:
enable:true
line_number:false
auto_detect:false
tab_replace: