fi3ework / hexo-theme-archer

🎯 A smart and modern theme for Hexo.
https://fi3ework.github.io/hexo-theme-archer
MIT License
1.5k stars 274 forks source link

更换主题后,.md文件生成0kb的.html文件 #286

Closed liuyingqiao2019 closed 2 years ago

liuyingqiao2019 commented 3 years ago

使用hexo g -debug命令发现报错如下:

ERROR D:\blog\Hexo\themes\archer\layout\layout.ejs:15
    13|     <%- partial('_partial/base-header') %>
    14|     <div class="wrapper">
 >> 15|         <%- partial('_partial/base-background-image') %>
    16|         <%- partial('_partial/script/font-loader') %>
    17|         <img class="loading" src="<%- url_for('assets/loading.svg') %>" style="display: block; margin: 6rem auto 0 auto; width: 6rem; height: 6rem;" />
    18|         <div class="container container-unloaded">

D:\blog\Hexo\themes\archer\layout\_partial\base-background-image.ejs:63
    61|                 <% if(theme.reading_info) { %>
    62|                     <div class="post-intro-read">
 >> 63|                         <span><%- __('word_count') %>: <span class="post-count word-count"><%= wordcount(page.content) %></span><%= __('reading_time') %>: <span class="post-count reading-time"><%= min2read(page.content) %> min</span></span>
    64|                     </div>
    65|                 <% } %>
    66|                 <div class="post-intro-meta">

wordcount is not defined
ReferenceError: D:\blog\Hexo\themes\archer\layout\layout.ejs:15
    13|     <%- partial('_partial/base-header') %>
    14|     <div class="wrapper">
 >> 15|         <%- partial('_partial/base-background-image') %>
    16|         <%- partial('_partial/script/font-loader') %>
    17|         <img class="loading" src="<%- url_for('assets/loading.svg') %>" style="display: block; margin: 6rem auto 0 auto; width: 6rem; height: 6rem;" />
    18|         <div class="container container-unloaded">

D:\blog\Hexo\themes\archer\layout\_partial\base-background-image.ejs:63
    61|                 <% if(theme.reading_info) { %>
    62|                     <div class="post-intro-read">
 >> 63|                         <span><%- __('word_count') %>: <span class="post-count word-count"><%= wordcount(page.content) %></span><%= __('reading_time') %>: <span class="post-count reading-time"><%= min2read(page.content) %> min</span></span>
    64|                     </div>
    65|                 <% } %>
    66|                 <div class="post-intro-meta">

wordcount is not defined

跪求大佬解答

secsilm commented 3 years ago

看起来你没有安装 wordcount,参照 安装步骤 安装一下主题。

此外,如果你是重新安装的 hexo,那么可能是 hexo 版本过高的问题,我最近就是遇到这个问题导致生成的 html 为空,参见 hexo 生成的 html 文件为空的问题 · Alan Lee

LolipopJ commented 2 years ago

Absolutely right。

请使用 这里 的命令安装主题:

# 首先移动到 Hexo 根目录下
npm i hexo-generator-json-content --save && npm i --save hexo-wordcount && git clone https://github.com/fi3ework/hexo-theme-archer.git themes/archer --depth=1

这行命令做了如下的事情:

如果没有更多问题,我将关闭此 Issue 😄