解决有关很久没更新后使用hexo s报错的问题

解决有关很久没更新后使用hexo s报错的问题

Zephyr

因为个人原因很久没更新博客,前几天想着更新我的博客,写好后拿去Hexo s ,结果报错 。下面是报错结果:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
PS D:\blog> hexo s
INFO Validating config
WARN Deprecated config detected: "external_link" with a Boolean value is deprecated. See https://hexo.io/docs/configuration for more details.
ERROR Plugin load failed: hexo-butterfly-clock
Error: ENOENT: no such file or directory, open 'D:\blog\node_modules\hexo-butterfly-clock'
ERROR Plugin load failed: hexo-wordcount
Error: ENOENT: no such file or directory, open 'D:\blog\node_modules\hexo-wordcount'

INFO
===================================================================

##### # # ##### ##### ###### ##### ###### # # #
# # # # # # # # # # # # #
##### # # # # ##### # # ##### # #
# # # # # # # ##### # # #
# # # # # # # # # # # #
##### #### # # ###### # # # ###### #

4.4.0
===================================================================
Unhandled rejection TypeError: D:\blog\node_modules\hexo-theme-butterfly\layout\includes\widget\index.pug:33
31| !=partial('includes/widget/card_tags', {}, {cache: true})
32| !=partial('includes/widget/card_archives', {}, {cache: true})

> 33| !=partial('includes/widget/card_webinfo', {}, {cache: true})
> 34| !=partial('includes/widget/card_bottom_self', {}, {cache: true})

D:\blog\node_modules\hexo-theme-butterfly\layout\includes\widget\card_webinfo.pug:19
17| .webinfo-item
18| .item-name=_p('aside.card_webinfo.site_wordcount') + " :"
> 19| .item-count=totalcount(site)
> 20| if theme.busuanzi.site_uv
> 21| .webinfo-item
> 22| .item-name= _p('aside.card_webinfo.site_uv_name') + " :"

totalcount is not a function
at eval (eval at wrap (D:\blog\node_modules\pug-runtime\wrap.js:6:10), <anonymous>:58:57)
at template (eval at wrap (D:\blog\node_modules\pug-runtime\wrap.js:6:10), <anonymous>:101:7)
at _View._compiledSync (D:\blog\node_modules\hexo\lib\theme\view.js:132:24)
at _View.renderSync (D:\blog\node_modules\hexo\lib\theme\view.js:59:25)
at D:\blog\node_modules\hexo\lib\plugins\helper\partial.js:31:52
at Cache.apply (D:\blog\node_modules\hexo-util\lib\cache.js:27:46)
at Object.fragmentCache (D:\blog\node_modules\hexo\lib\plugins\helper\fragment_cache.js:11:34)
at Object.partial (D:\blog\node_modules\hexo\lib\plugins\helper\partial.js:31:17)
at eval (eval at wrap (D:\blog\node_modules\pug-runtime\wrap.js:6:10), <anonymous>:1896:46)
at template (eval at wrap (D:\blog\node_modules\pug-runtime\wrap.js:6:10), <anonymous>:5857:7)
at _View._compiled (D:\blog\node_modules\hexo\lib\theme\view.js:136:50)
at _View.render (D:\blog\node_modules\hexo\lib\theme\view.js:39:17)
at D:\blog\node_modules\hexo\lib\hexo\index.js:64:21
at tryCatcher (D:\blog\node_modules\bluebird\js\release\util.js:16:23)
at D:\blog\node_modules\bluebird\js\release\method.js:15:34
at RouteStream._read (D:\blog\node_modules\hexo\lib\hexo\router.js:47:5)
at Readable.read (node:internal/streams/readable:496:12)
at resume_ (node:internal/streams/readable:999:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

思路一

因为很久没更新 ,我第一时间想到的是不是因为node.js 和npm版本太老了?于是就更新了node.js 和npm。

node.js更新我是去官网下载最新版安装包 。

而npm更新则是用命令行更新。

NPM更新到最新版命令:

1
npm install -g npm

思路二

现在电脑上的node.js 和npm均是最新版了,但是hexo s后仍然报错,还是同样的ERROR,但是看到别人却成功了。于是分析了一下报错信息,

发现了这几行东西:

1
2
3
4
ERROR Plugin load failed: hexo-butterfly-clock
Error: ENOENT: no such file or directory, open 'D:\blog\node_modules\hexo-butterfly-clock'
ERROR Plugin load failed: hexo-wordcount
Error: ENOENT: no such file or directory, open 'D:\blog\node_modules\hexo-wordcount'

就发现根本原因是hexo-butterfly-clock和hexo-wordcount这2个插件缺失

于是就立马下载插件

安装hexo-butterfly-clock

1
npm install hexo-butterfly-clock --save 

或者

1
cnpm install hexo-butterfly-clock --save

安装hexo-wordcount

1
npm install hexo-wordcount --save

或者

1
cnpm install hexo-wordcount --save

到此,再次hexo s ,可发现问题已解决。

On this page
解决有关很久没更新后使用hexo s报错的问题