Hexo 的等级提升了!
野生的问题出现了!
问题被打败了!
# Hexo 升级
由于我的升级方法一定不是最佳的(通过 npm audit
+manual 操作升级),故摘网上的升级方法于此。
作者:LANVNAL
链接:https://www.jianshu.com/p/802182c01b59
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
全局升级 hexo-cli,先
hexo version
查看当前版本,然后npm i hexo-cli -g
,再次hexo version
查看是否升级成功。使用
npm install -g npm-check
和npm-check
,检查系统中的插件是否有升级的,可以看到自己前面都安装了那些插件使用
npm install -g npm-upgrade
和npm-upgrade
,升级系统中的插件使用
npm update -g
和npm update --save
# 问题排查
升级后在 hexo g
时出现错误,具体报错如下:
INFO Validating config
INFO Start processing
FATAL { err:
TypeError: line.matchAll is not a function
at res.value.res.value.split.map.line (/**/hexosite/node_modules/hexo-util/lib/highlight.js:128:26)
at Array.map (<anonymous>)
at closeTags (/**/hexosite/node_modules/hexo-util/lib/highlight.js:126:37)
at highlight (/**/hexosite/node_modules/hexo-util/lib/highlight.js:119:10)
at highlightUtil (/**/hexosite/node_modules/hexo-util/lib/highlight.js:23:16)
at data.content.dataContent.replace (/**/hexosite/node_modules/hexo/lib/plugins/filter/before_post_render/backtick_code_block.js:92:17)
at String.replace (<anonymous>)
at Hexo.backtickCodeBlock (/**/hexosite/node_modules/hexo/lib/plugins/filter/before_post_render/backtick_code_block.js:19:30)
at Hexo.tryCatcher (/**/hexosite/node_modules/bluebird/js/release/util.js:16:23)
at Hexo.<anonymous> (/**/hexosite/node_modules/bluebird/js/release/method.js:15:34)
at Promise.each.filter (/**/hexosite/node_modules/hexo/lib/extend/filter.js:67:52)
at tryCatcher (/**/hexosite/node_modules/bluebird/js/release/util.js:16:23)
at Object.gotValue (/**/hexosite/node_modules/bluebird/js/release/reduce.js:166:18)
at Object.gotAccum (/**/hexosite/node_modules/bluebird/js/release/reduce.js:155:25)
at Object.tryCatcher (/**/hexosite/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/**/hexosite/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/**/hexosite/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromiseCtx (/**/hexosite/node_modules/bluebird/js/release/promise.js:641:10)
at _drainQueueStep (/**/hexosite/node_modules/bluebird/js/release/async.js:97:12)
at _drainQueue (/**/hexosite/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/**/hexosite/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/**/hexosite/node_modules/bluebird/js/release/async.js:15:14) }
'Something\'s wrong. Maybe you can find the solution here: %s' '\u001b[4mhttps://hexo.io/docs/troubleshooting.html\u001b[24m'
经排查,发现问题出现在 Node.js
的版本上。由于 Node.js 10
在 2021 年 8 月 30 日已停止服务,新版本的 Hexo
需要 Node.js
版本在 12.0+。
但 ubuntu 默认软件源仓库中 Node.js
的版本仍为 10,故需要额外的步骤来更新:
首先更新系统以保证不会发生依赖错误:
sudo apt update
sudo apt -y upgrade
添加仓库
sudo apt update
sudo apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
更新 Node
sudo apt -y install nodejs
自此,故障得以解决。