next-theme / hexo-theme-next

🎉 Elegant and powerful theme for Hexo.
https://theme-next.js.org
Other
2.34k stars 420 forks source link

Giscus render error #700

Closed tisonkun closed 8 months ago

tisonkun commented 9 months ago

Issue Checklist

Expected behavior

正常构建。

Actual behavior

我不确定是 Giscus 插件的问题还是本仓库的问题,因为报在 node_modules/hexo-theme-next/layout 下我就先 report 在这里。

https://github.com/tisonkun/blog/tree/bf2e45004a4ba861de3a283da6aa8d90532b8a8c

https://blog-5evv3lisv-tisonkun.vercel.app/

INFO  Validating config
INFO  ==================================
  ███╗   ██╗███████╗██╗  ██╗████████╗
  ████╗  ██║██╔════╝╚██╗██╔╝╚══██╔══╝
  ██╔██╗ ██║█████╗   ╚███╔╝    ██║
  ██║╚██╗██║██╔══╝   ██╔██╗    ██║
  ██║ ╚████║███████╗██╔╝ ██╗   ██║
  ╚═╝  ╚═══╝╚══════╝╚═╝  ╚═╝   ╚═╝
========================================
NexT version 8.18.1
Documentation: https://theme-next.js.org
========================================
INFO  Start processing
INFO  Hexo is running at http://localhost:4000/ . Press Ctrl+C to stop.
Unhandled rejection Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/index.njk)
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/index.njk) [Line 29, Column 25]
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/index.njk) [Line 49, Column 17]
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/index.njk)
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/_partials/head/head-unique.njk) [Line 19, Column 12]
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/index.njk) [Line 3, Column 3]
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/index.njk)
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/_partials/header/index.njk) [Line 6, Column 15]
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/index.njk) [Line 5, Column 3]
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/index.njk)
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/_partials/header/sub-menu.njk) [Line 2, Column 29]
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/index.njk)
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/_partials/header/sub-menu.njk)
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/index.njk) [Line 10, Column 14]
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/index.njk)
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/_partials/pagination.njk) [Line 2, Column 21]
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/index.njk)
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/_partials/comments.njk)
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/index.njk)
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/_partials/languages.njk)
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/index.njk)
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/_third-party/math/index.njk)
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/index.njk)
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/_third-party/quicklink.njk)
  Template render error: (/Users/tison/Brittani/blog/node_modules/hexo-theme-next/layout/inject/bodyEnd/giscus.njk)
  TypeError: Cannot read properties of undefined (reading 'replace')
    at Object._prettifyError (/Users/tison/Brittani/blog/node_modules/nunjucks/src/lib.js:32:11)
    at /Users/tison/Brittani/blog/node_modules/nunjucks/src/environment.js:464:19
    at Template.root [as rootRenderFunc] (eval at _compile (/Users/tison/Brittani/blog/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:45:3)
    at Template.render (/Users/tison/Brittani/blog/node_modules/nunjucks/src/environment.js:454:10)
    at /Users/tison/Brittani/blog/node_modules/hexo/dist/plugins/renderer/nunjucks.js:62:39
    at _View._compiled (/Users/tison/Brittani/blog/node_modules/hexo/dist/theme/view.js:125:67)
    at _View.render (/Users/tison/Brittani/blog/node_modules/hexo/dist/theme/view.js:50:21)
    at /Users/tison/Brittani/blog/node_modules/hexo/dist/hexo/index.js:58:29
    at tryCatcher (/Users/tison/Brittani/blog/node_modules/bluebird/js/release/util.js:16:23)
    at /Users/tison/Brittani/blog/node_modules/bluebird/js/release/method.js:15:34
    at RouteStream._read (/Users/tison/Brittani/blog/node_modules/hexo/dist/hexo/router.js:43:9)
    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)

Steps to reproduce the behavior

Clone + yarn install + yarn hexo s

Node.js and NPM Information

v18.16.1
9.5.1

Package dependencies Information

..

Hexo Configuration

..

NexT Configuration

..

Other Information

No response

PeichengLiu commented 8 months ago

See next-theme/hexo-next-giscus/issues/8.

PeichengLiu commented 8 months ago

@stevenjoezhang 为什么对 giscus 的支持以插件形式存在?我自己仿照 gitalk 的配置写了一份才发现有这么个插件。

stevenjoezhang commented 8 months ago

hexo-next-giscus 已发布新版本,更新一下即可

npm i hexo-next-giscus@1.2.0

独立出插件的原因是目前 NexT 里面集成的评论数量太多了,有 7 个评论系统以插件形式发布: https://github.com/next-theme/awesome-next?tab=readme-ov-file#comment

tisonkun commented 8 months ago

验证有效 - https://www.tisonkun.org/2023/09/16/oss-develop/

BTW 最新一篇博客也提到了 NexT 项目,感谢一直以来的开发维护 :D