TypeError: Cannot set property 'lastIndex' of undefined

环境

节点版本 (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:



评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

MobiusStrip

请我喝杯奶茶吧

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值