因为闲来无事,看着hexo的butterfly主题已经到了4.12版本,打算升级一下,主题版本,于是打开官网,查看升级方法,非常简单,一条命令即可
升级方法:在 Hexo 根目录下,运行 npm update hexo-theme-butterfly
但是新版本的butterfly主题需要较新的hexo 版本,所以首先进行了hexo的升级,hexo升级也挺麻烦,升级完成之后运行npm的升级命令,结果并为进行升级,而且,运行 hexo clean等相关命令发生以下报错:
代码语言:js复制❯ hexo clean
INFO Validating config
ERROR Script load failed: themesbutterflyscriptseventsinit.js
TypeError: require(...) is not a function
at D:Blogthemesbutterflyscriptseventsinit.js:1:106
at D:Blognode_moduleshexodisthexoindex.js:248:20
at tryCatcher (D:Blognode_modulesbluebirdjsreleaseutil.js:16:23)
at Promise._settlePromiseFromHandler (D:Blognode_modulesbluebirdjsreleasepromise.js:547:31)
at Promise._settlePromise (D:Blognode_modulesbluebirdjsreleasepromise.js:604:18)
at Promise._settlePromise0 (D:Blognode_modulesbluebirdjsreleasepromise.js:649:10)
at Promise._settlePromises (D:Blognode_modulesbluebirdjsreleasepromise.js:729:18)
at _drainQueueStep (D:Blognode_modulesbluebirdjsreleaseasync.js:93:12)
at _drainQueue (D:Blognode_modulesbluebirdjsreleaseasync.js:86:9)
at Async._drainQueues (D:Blognode_modulesbluebirdjsreleaseasync.js:102:5)
at Async.drainQueues (D:Blognode_modulesbluebirdjsreleaseasync.js:15:14)
at process.processImmediate (node:internal/timers:471:21)
ERROR Script load failed: themesbutterflyscriptseventswelcome.js
TypeError: require(...) is not a function
at D:Blogthemesbutterflyscriptseventswelcome.js:1:106
at D:Blognode_moduleshexodisthexoindex.js:248:20
at tryCatcher (D:Blognode_modulesbluebirdjsreleaseutil.js:16:23)
at Promise._settlePromiseFromHandler (D:Blognode_modulesbluebirdjsreleasepromise.js:547:31)
at Promise._settlePromise (D:Blognode_modulesbluebirdjsreleasepromise.js:604:18)
at Promise._settlePromise0 (D:Blognode_modulesbluebirdjsreleasepromise.js:649:10)
at Promise._settlePromises (D:Blognode_modulesbluebirdjsreleasepromise.js:729:18)
at _drainQueueStep (D:Blognode_modulesbluebirdjsreleaseasync.js:93:12)
at _drainQueue (D:Blognode_modulesbluebirdjsreleaseasync.js:86:9)
at Async._drainQueues (D:Blognode_modulesbluebirdjsreleaseasync.js:102:5)
at Async.drainQueues (D:Blognode_modulesbluebirdjsreleaseasync.js:15:14)
at process.processImmediate (node:internal/timers:471:21)
报错原因主要是以下内容,看描述好像是出现了语法问题,实际是因为高版本的hexo和低版本的butterfly有冲突
代码语言:js复制themesbutterflyscriptseventsinit.js
TypeError: require(...) is not a function
这个时候因为 npm的升级命令不起作用,需要将themes主题下的butterfly文件夹全部删除,然后在blog的根目录直接运行下面git命令,将最新版的butterfly主题clone下来即可
代码语言:shell复制git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly
然后运行 hexo clean 等相关命令恢复正常