jerryc127 / hexo-theme-butterfly

🦋 A Hexo Theme: Butterfly
https://butterfly.js.org
Apache License 2.0
7.16k stars 1.29k forks source link

[Bug]: 按照文档配置完成,第一次启动报错 #951

Closed yuanoOo closed 2 years ago

yuanoOo commented 2 years ago

使用的 Butterfly 版本? | What version of Butterfly are you use?

4.3.0

使用的瀏覽器? || What browse are you using?

Chrome

使用的系統? || What operating system are you using?

Linux

問題描述 | Describe the bug

System:WSL-unbtun

Error

INFO  Start processing
INFO  Files loaded in 5.09 s
ERROR TypeError: /home/demo/hexo/hexo-blog/node_modules/hexo-theme-butterfly/layout/includes/head.pug:2
    1| - var pageTitle
  > 2| - if (is_archive()) pageTitle = fragment_cache('findArchivesTitle', function(){return findArchivesTitle(theme.menu);})
    3| - else if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag
    4| - else if (is_category()) pageTitle = _p('page.category') + ': ' + page.category
    5| - else if (is_month()) pageTitle += ': ' + page.month + '/' + page.year

Cannot read properties of null (reading 'year')
    at Object.<anonymous> (/home/demo/hexo/hexo-blog/node_modules/hexo-theme-butterfly/scripts/helpers/page.js:75:12)
    at eval (eval at wrap (/home/demo/hexo/hexo-blog/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:24:85)
    at Cache.apply (/home/demo/hexo/hexo-blog/node_modules/hexo-util/lib/cache.js:27:46)
    at Object.fragmentCache (/home/demo/hexo/hexo-blog/node_modules/hexo/lib/plugins/helper/fragment_cache.js:11:34)
    at eval (eval at wrap (/home/demo/hexo/hexo-blog/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:24:31)
    at template (eval at wrap (/home/demo/hexo/hexo-blog/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:4694:7)
    at _View._compiled (/home/demo/hexo/hexo-blog/node_modules/hexo/lib/theme/view.js:136:50)
    at _View.render (/home/demo/hexo/hexo-blog/node_modules/hexo/lib/theme/view.js:39:17)
    at /home/demo/hexo/hexo-blog/node_modules/hexo/lib/hexo/index.js:64:21
    at tryCatcher (/home/demo/hexo/hexo-blog/node_modules/bluebird/js/release/util.js:16:23)
    at /home/demo/hexo/hexo-blog/node_modules/bluebird/js/release/method.js:15:34
    at RouteStream._read (/home/demo/hexo/hexo-blog/node_modules/hexo/lib/hexo/router.js:47:5)
    at RouteStream.Readable.read (node:internal/streams/readable:487:10)
    at resume_ (node:internal/streams/readable:987:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  path: '/home/demo/hexo/hexo-blog/node_modules/hexo-theme-butterfly/layout/includes/head.pug'
}

hexo-env:

hexo: 6.2.0
hexo-cli: 4.3.0
os: linux 5.10.16.3-microsoft-standard-WSL2 Ubuntu 20.04 LTS (Focal Fossa)
node: 16.15.1
v8: 9.4.146.24-node.21
uv: 1.43.0
zlib: 1.2.11
brotli: 1.0.9
ares: 1.18.1
modules: 93
nghttp2: 1.47.0
napi: 8
llhttp: 6.0.4
openssl: 1.1.1o+quic
cldr: 40.0
icu: 70.1
tz: 2021a3
unicode: 14.0
ngtcp2: 0.1.0-DEV
nghttp3: 0.1.0-DEV

使用fluid主题没有问题,切换后,启动报错

出現問題網站 | Website

@

jerryc127 commented 2 years ago

运行 hexo clean 然后 运行 hexo g -- debug

截取报错

yuanoOo commented 2 years ago
# DESKTOP-KD33OT8➜  hexo-blog  ᐅ  hexo clean
INFO  Validating config
INFO
  ===================================================================

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

                            4.3.0
  ===================================================================
INFO  Deleted database.
INFO  Deleted public folder.
# DESKTOP-KD33OT8➜  hexo-blog  ᐅ  hexo g -debug
INFO  Validating config
INFO
  ===================================================================

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

                            4.3.0
  ===================================================================
INFO  Start processing
INFO  Files loaded in 4.35 s
FATAL {
  err: TypeError: /home/demo/hexo/hexo-blog/node_modules/hexo-theme-butterfly/layout/includes/head.pug:2
      1| - var pageTitle
    > 2| - if (is_archive()) pageTitle = fragment_cache('findArchivesTitle', function(){return findArchivesTitle(theme.menu);})
      3| - else if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag
      4| - else if (is_category()) pageTitle = _p('page.category') + ': ' + page.category
      5| - else if (is_month()) pageTitle += ': ' + page.month + '/' + page.year

  Cannot read properties of null (reading 'year')
      at Object.<anonymous> (/home/demo/hexo/hexo-blog/node_modules/hexo-theme-butterfly/scripts/helpers/page.js:75:12)
      at eval (eval at wrap (/home/demo/hexo/hexo-blog/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:24:85)
      at Cache.apply (/home/demo/hexo/hexo-blog/node_modules/hexo-util/lib/cache.js:27:46)
      at Object.fragmentCache (/home/demo/hexo/hexo-blog/node_modules/hexo/lib/plugins/helper/fragment_cache.js:11:34)
      at eval (eval at wrap (/home/demo/hexo/hexo-blog/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:24:31)
      at template (eval at wrap (/home/demo/hexo/hexo-blog/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:4694:7)
      at _View._compiled (/home/demo/hexo/hexo-blog/node_modules/hexo/lib/theme/view.js:136:50)
      at _View.render (/home/demo/hexo/hexo-blog/node_modules/hexo/lib/theme/view.js:39:17)
      at /home/demo/hexo/hexo-blog/node_modules/hexo/lib/hexo/index.js:64:21
      at tryCatcher (/home/demo/hexo/hexo-blog/node_modules/bluebird/js/release/util.js:16:23)
      at /home/demo/hexo/hexo-blog/node_modules/bluebird/js/release/method.js:15:34
      at RouteStream._read (/home/demo/hexo/hexo-blog/node_modules/hexo/lib/hexo/router.js:47:5)
      at RouteStream.Readable.read (node:internal/streams/readable:487:10)
      at resume_ (node:internal/streams/readable:987:12)
      at processTicksAndRejections (node:internal/process/task_queues:83:21) {
    path: '/home/demo/hexo/hexo-blog/node_modules/hexo-theme-butterfly/layout/includes/head.pug'
  }
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html
INFO  Generated: about/index.html
INFO  Generated: index.html
INFO  Generated: img/404.jpg
INFO  Generated: categories/网易云/index.html
INFO  Generated: img/friend_404.gif
INFO  Generated: img/favicon.png
INFO  Generated: tags/网易云/index.html
INFO  Generated: img/cat.png
INFO  Generated: css/index.css
INFO  Generated: js/tw_cn.js
INFO  Generated: js/search/algolia.js
INFO  Generated: css/var.css
INFO  Generated: js/main.js
INFO  Generated: img/bg/banner.webp
INFO  Generated: js/utils.js
INFO  Generated: js/search/local-search.js
INFO  Generated: 2022/06/25/zhihu-emo-yulu/index.html
INFO  Generated: 2022/06/24/hello-world/index.html
jerryc127 commented 2 years ago

https://github.com/jerryc127/hexo-theme-butterfly/commit/dbb31dec99c326b07e8bf004be165e65472562d5