jerryc127 / hexo-theme-butterfly

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

[Bug]: `urlNoIndex is not a function` when build site #1595

Closed GZTimeWalker closed 3 hours ago

GZTimeWalker commented 3 hours ago

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

5.2.0

是否修改過主題文件? | Has the theme files been modified?

否 (No)

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

Chrome

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

macOS

依賴插件 | Package dependencies information

dependencies:
@neilsustc/markdown-it-katex 1.0.0  hexo-deployer-git 4.0.0             hexo-generator-sitemap 3.0.1        hexo-server 3.0.0                   
cli 1.0.1                           hexo-filter-nofollow 2.0.2          hexo-generator-tag 2.0.0            hexo-theme-butterfly 5.2.0          
eslint 9.14.0                       hexo-generator-archive 2.0.0        hexo-hide-posts 0.4.3               hexo-util 3.3.0                     
eslint-plugin-n 17.12.0             hexo-generator-baidu-sitemap 0.1.9  hexo-log 4.1.0                      hexo-wordcount 6.0.1                
hexo 7.3.0                          hexo-generator-category 2.0.0       hexo-neat 1.0.9                     markdown-it 14.1.0                  
hexo-abbrlink 2.2.1                 hexo-generator-feed 3.0.0           hexo-renderer-ejs 2.0.0             nanocolors 0.2.13                   
hexo-all-minifier 0.5.7             hexo-generator-index 4.0.0          hexo-renderer-markdown-it 7.1.1     object-assign 4.1.1                 
hexo-blog-encrypt 3.1.9             hexo-generator-robotstxt 0.2.0      hexo-renderer-pug 3.0.0             pug 3.0.3                           
hexo-butterfly-artitalk 1.0.4       hexo-generator-search 2.4.3         hexo-renderer-stylus 3.0.1          utils-merge 1.0.1                   

問題描述 | Describe the bug

when build

Unhandled rejection TypeError: /Users/gztime/Projects/BLOG/node_modules/hexo-theme-butterfly/layout/includes/head.pug:29
    27| 
    28| !=favicon_tag(theme.favicon || config.favicon)
  > 29| link(rel="canonical" href=urlNoIndex(null,config.pretty_urls.trailing_index,config.pretty_urls.trailing_html))
    30| 
    31| //- 預解析
    32| !=partial('includes/head/preconnect', {}, {cache: true})

urlNoIndex is not a function
    at eval (eval at wrap (/Users/gztime/Projects/BLOG/node_modules/.pnpm/pug-runtime@3.0.1/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:91:77)
    at template (eval at wrap (/Users/gztime/Projects/BLOG/node_modules/.pnpm/pug-runtime@3.0.1/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:6669:7)
    at _View._compiled (/Users/gztime/Projects/BLOG/node_modules/.pnpm/hexo@7.3.0_chokidar@3.6.0/node_modules/hexo/dist/theme/view.js:120:67)
    at _View.render (/Users/gztime/Projects/BLOG/node_modules/.pnpm/hexo@7.3.0_chokidar@3.6.0/node_modules/hexo/dist/theme/view.js:37:21)
    at /Users/gztime/Projects/BLOG/node_modules/.pnpm/hexo@7.3.0_chokidar@3.6.0/node_modules/hexo/dist/hexo/index.js:60:29
    at tryCatcher (/Users/gztime/Projects/BLOG/node_modules/.pnpm/bluebird@3.7.2/node_modules/bluebird/js/release/util.js:16:23)
    at /Users/gztime/Projects/BLOG/node_modules/.pnpm/bluebird@3.7.2/node_modules/bluebird/js/release/method.js:15:34
    at RouteStream._read (/Users/gztime/Projects/BLOG/node_modules/.pnpm/hexo@7.3.0_chokidar@3.6.0/node_modules/hexo/dist/hexo/router.js:43:9)
    at Readable.read (node:internal/streams/readable:739:12)
    at resume_ (node:internal/streams/readable:1257:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
GZTimeWalker commented 3 hours ago

solved by pnpm add moment-timezone, strange reason...

jerryc127 commented 50 minutes ago

这个不是Hexo 自带的么

GZTimeWalker commented 49 minutes ago

moment-timezone

我估计是因为 moment-timezone 没安装,导致一些 js 没执行……