SukkaW / hexo-theme-suka

🎨Modern, powerful and simple theme for Hexo.
https://theme-suka.skk.moe
GNU General Public License v3.0
609 stars 49 forks source link

The search.json was generated but the search page wouldn't be generated #52

Closed dragonJACson closed 5 years ago

dragonJACson commented 5 years ago

I certify that I have first consulted (check with "x")

我确认我已经查看了 (选择时请使用 "x" 取代方括号中的空格)


如果你遇到了运行 hexo g hexo s 时报错

If you get error when you are running hexo s hexo g.

The search.json was generated but the search page wouldn't be generated

Node.js and NPM Information

Node.js 和 NPM 的相关信息

$ node -v && npm -v
v8.11.3
6.1.0

Package dependencies Information

依赖包相关信息

{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "hexo": {
    "version": "3.8.0"
  },
  "dependencies": {
    "hexo": "^3.7.0",
    "hexo-deployer-git": "^0.3.1",
    "hexo-generator-archive": "^0.1.5",
    "hexo-generator-category": "^0.1.3",
    "hexo-generator-index": "^0.2.1",
    "hexo-generator-tag": "^0.2.0",
    "hexo-renderer-ejs": "^0.3.1",
    "hexo-renderer-marked": "^0.3.2",
    "hexo-renderer-stylus": "^0.3.3",
    "hexo-server": "^0.3.1"
  }
}
{
  "name": "hexo-theme-suka",
  "version": "0.0.1",
  "description": "Modern, powerful and simple theme for Hexo",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "setup": "npm cache clean && npm install",
    "lint": "bash lint.sh"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/SukkaW/hexo-theme-suka.git"
  },
  "keywords": [
    "hexo",
    "hexo-theme",
    "suka",
    "sukkaw"
  ],
  "author": "SukkaW",
  "license": "GPL-3.0",
  "bugs": {
    "url": "https://github.com/SukkaW/hexo-theme-suka/issues"
  },
  "homepage": "https://github.com/SukkaW/hexo-theme-suka#readme",
  "devDependencies": {
    "ejs-lint": "0.3.0",
    "eslint": "5.8.0",
    "gulp": "4.0.0",
    "gulp-autoprefixer": "6.0.0",
    "gulp-clean-css": "3.10.0",
    "gulp-rename": "1.4.0",
    "gulp-uglify": "3.0.1",
    "sass-lint": "1.12.1"
  },
  "dependencies": {
    "json-stringify-safe": "5.0.1",
    "node-prismjs": "0.1.2",
    "prismjs": "1.15.0",
    "qr-image": "3.2.0"
  }
}

Hexo version

Hexo 版本号

$ hexo -v
hexo: 3.8.0
hexo-cli: 1.1.0
os: Linux 4.19.2-arch1-1-ARCH linux x64
http_parser: 2.8.0
node: 8.11.3
v8: 6.2.414.54
uv: 1.19.1
zlib: 1.2.11
ares: 1.10.1-DEV
modules: 57
nghttp2: 1.32.0
napi: 3
openssl: 1.0.2o
icu: 60.1
unicode: 10.0
cldr: 32.0
tz: 2017c

Hexo & Theme Configuration

站点配置文件和主题配置文件

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: suka
suka_theme:
  search:
    enable: true
    path: search.json
    field: post # Page | Post | All. Default post
  prism:
    enable: false
    line_number: true
    theme: default
head:
  open_search: /source/opensearch.xml
nav:
  home:
    use: true
  archives:
    use: true
  rss:
    use: false
  share:
    use: true
  search:
    use: true
    link: /search
search:
  use: local
  # Swiftype
  swiftype_key:
verison: 1.3.1.3

Error Log

报错日志

$ hexo g
INFO  Start processing
INFO  Files loaded in 991 ms
ERROR /home/luke/workspace/Hexo-zganga/themes/suka/layout/post.ejs:12
    10| <% } else { %>
    11|     <!-- ## Post ## -->
 >> 12|     <%- partial('_pages/post') %>
    13| <% } %>

/home/luke/workspace/Hexo-zganga/themes/suka/layout/_pages/post.ejs:18
    16|                 <!-- # Post Header Info # -->
    17|                 <div class="card-header">
 >> 18|                     <%- partial('_partial/post/header-info') %>
    19|                 </div>
    20|                 <div class="card-body">
    21|                     <% if ( (theme.toc.enable === true) && (page.toc !== false) ) { %>

/home/luke/workspace/Hexo-zganga/themes/suka/layout/_partial/post/header-info.ejs:10
    8|         <% if (page.categories && page.categories.length) { %>
    9|             <span class="suka-devide-dot"></span>
 >> 10|             <%- list_categories(page.categories, {
    11|                 show_count: false,
    12|                 separator: '<span class="suka-devide-dot"></span>',
    13|                 style: 'none'

categories.find is not a function
TypeError: /home/luke/workspace/Hexo-zganga/themes/suka/layout/post.ejs:12
    10| <% } else { %>                                                                                                                            
    11|     <!-- ## Post ## -->                                                                                                                   
 >> 12|     <%- partial('_pages/post') %>                                                                                                         
    13| <% } %>                                                                                                                                   

/home/luke/workspace/Hexo-zganga/themes/suka/layout/_pages/post.ejs:18                                                                            
    16|                 <!-- # Post Header Info # -->                                                                                             
    17|                 <div class="card-header">                                                                                                 
 >> 18|                     <%- partial('_partial/post/header-info') %>                                                                           
    19|                 </div>                                                                                                                    
    20|                 <div class="card-body">                                                                                                   
    21|                     <% if ( (theme.toc.enable === true) && (page.toc !== false) ) { %>                                                    

/home/luke/workspace/Hexo-zganga/themes/suka/layout/_partial/post/header-info.ejs:10                                                              
    8|         <% if (page.categories && page.categories.length) { %>                                                                             
    9|             <span class="suka-devide-dot"></span>                                                                                          
 >> 10|             <%- list_categories(page.categories, {                                                                                        
    11|                 show_count: false,                                                                                                        
    12|                 separator: '<span class="suka-devide-dot"></span>',                                                                       
    13|                 style: 'none'                                                                                                             

categories.find is not a function                                                                                                                 
    at prepareQuery (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/plugins/helper/list_categories.js:35:23)                              
    at flatList (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/plugins/helper/list_categories.js:93:5)                                   
    at Object.listCategoriesHelper (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/plugins/helper/list_categories.js:116:15)              
    at eval (eval at compile (/home/luke/workspace/Hexo-zganga/node_modules/ejs/lib/ejs.js:618:12), <anonymous>:29:17)                            
    at returnedFn (/home/luke/workspace/Hexo-zganga/node_modules/ejs/lib/ejs.js:653:17)                                                           
    at Theme._View.View._compiledSync.locals [as _compiledSync] (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/theme/view.js:121:22)     
    at Theme._View.View.View.renderSync (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/theme/view.js:49:23)                              
    at Object.partial (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/plugins/helper/partial.js:38:15)                                    
    at eval (eval at compile (/home/luke/workspace/Hexo-zganga/node_modules/ejs/lib/ejs.js:618:12), <anonymous>:31:17)                            
    at returnedFn (/home/luke/workspace/Hexo-zganga/node_modules/ejs/lib/ejs.js:653:17)                                                           
    at Theme._View.View._compiledSync.locals [as _compiledSync] (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/theme/view.js:121:22)     
    at Theme._View.View.View.renderSync (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/theme/view.js:49:23)                              
    at Object.partial (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/plugins/helper/partial.js:38:15)                                    
    at eval (eval at compile (/home/luke/workspace/Hexo-zganga/node_modules/ejs/lib/ejs.js:618:12), <anonymous>:30:17)                            
    at returnedFn (/home/luke/workspace/Hexo-zganga/node_modules/ejs/lib/ejs.js:653:17)                                                           
    at Theme._View.View._compiled.locals [as _compiled] (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/theme/view.js:125:48)             
    at Theme._View.View.View.render (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/theme/view.js:30:15)                                  
    at route.set (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/hexo/index.js:394:29)                                                    
    at tryCatcher (/home/luke/workspace/Hexo-zganga/node_modules/bluebird/js/release/util.js:16:23)                                               
    at /home/luke/workspace/Hexo-zganga/node_modules/bluebird/js/release/method.js:15:34                                                          
    at RouteStream._read (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/hexo/router.js:134:3)                                            
    at RouteStream.Readable.read (_stream_readable.js:442:10)                                                                                     
ERROR /home/luke/workspace/Hexo-zganga/themes/suka/layout/post.ejs:12
    10| <% } else { %>
    11|     <!-- ## Post ## -->
 >> 12|     <%- partial('_pages/post') %>
    13| <% } %>

/home/luke/workspace/Hexo-zganga/themes/suka/layout/_pages/post.ejs:18
    16|                 <!-- # Post Header Info # -->
    17|                 <div class="card-header">
 >> 18|                     <%- partial('_partial/post/header-info') %>
    19|                 </div>
    20|                 <div class="card-body">
    21|                     <% if ( (theme.toc.enable === true) && (page.toc !== false) ) { %>

/home/luke/workspace/Hexo-zganga/themes/suka/layout/_partial/post/header-info.ejs:10
    8|         <% if (page.categories && page.categories.length) { %>
    9|             <span class="suka-devide-dot"></span>
 >> 10|             <%- list_categories(page.categories, {
    11|                 show_count: false,
    12|                 separator: '<span class="suka-devide-dot"></span>',
    13|                 style: 'none'

categories.find is not a function
TypeError: /home/luke/workspace/Hexo-zganga/themes/suka/layout/post.ejs:12
    10| <% } else { %>                                                                                                                            
    11|     <!-- ## Post ## -->                                                                                                                   
 >> 12|     <%- partial('_pages/post') %>                                                                                                         
    13| <% } %>                                                                                                                                   

/home/luke/workspace/Hexo-zganga/themes/suka/layout/_pages/post.ejs:18                                                                            
    16|                 <!-- # Post Header Info # -->                                                                                             
    17|                 <div class="card-header">                                                                                                 
 >> 18|                     <%- partial('_partial/post/header-info') %>                                                                           
    19|                 </div>                                                                                                                    
    20|                 <div class="card-body">                                                                                                   
    21|                     <% if ( (theme.toc.enable === true) && (page.toc !== false) ) { %>                                                    

/home/luke/workspace/Hexo-zganga/themes/suka/layout/_partial/post/header-info.ejs:10                                                              
    8|         <% if (page.categories && page.categories.length) { %>                                                                             
    9|             <span class="suka-devide-dot"></span>                                                                                          
 >> 10|             <%- list_categories(page.categories, {                                                                                        
    11|                 show_count: false,                                                                                                        
    12|                 separator: '<span class="suka-devide-dot"></span>',                                                                       
    13|                 style: 'none'                                                                                                             

categories.find is not a function                                                                                                                 
    at prepareQuery (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/plugins/helper/list_categories.js:35:23)                              
    at flatList (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/plugins/helper/list_categories.js:93:5)                                   
    at Object.listCategoriesHelper (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/plugins/helper/list_categories.js:116:15)              
    at eval (eval at compile (/home/luke/workspace/Hexo-zganga/node_modules/ejs/lib/ejs.js:618:12), <anonymous>:29:17)                            
    at returnedFn (/home/luke/workspace/Hexo-zganga/node_modules/ejs/lib/ejs.js:653:17)                                                           
    at Theme._View.View._compiledSync.locals [as _compiledSync] (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/theme/view.js:121:22)     
    at Theme._View.View.View.renderSync (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/theme/view.js:49:23)                              
    at Object.partial (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/plugins/helper/partial.js:38:15)                                    
    at eval (eval at compile (/home/luke/workspace/Hexo-zganga/node_modules/ejs/lib/ejs.js:618:12), <anonymous>:31:17)                            
    at returnedFn (/home/luke/workspace/Hexo-zganga/node_modules/ejs/lib/ejs.js:653:17)                                                           
    at Theme._View.View._compiledSync.locals [as _compiledSync] (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/theme/view.js:121:22)     
    at Theme._View.View.View.renderSync (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/theme/view.js:49:23)                              
    at Object.partial (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/plugins/helper/partial.js:38:15)                                    
    at eval (eval at compile (/home/luke/workspace/Hexo-zganga/node_modules/ejs/lib/ejs.js:618:12), <anonymous>:30:17)                            
    at returnedFn (/home/luke/workspace/Hexo-zganga/node_modules/ejs/lib/ejs.js:653:17)                                                           
    at Theme._View.View._compiled.locals [as _compiled] (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/theme/view.js:125:48)             
    at Theme._View.View.View.render (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/theme/view.js:30:15)                                  
    at route.set (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/hexo/index.js:394:29)                                                    
    at tryCatcher (/home/luke/workspace/Hexo-zganga/node_modules/bluebird/js/release/util.js:16:23)                                               
    at /home/luke/workspace/Hexo-zganga/node_modules/bluebird/js/release/method.js:15:34                                                          
    at RouteStream._read (/home/luke/workspace/Hexo-zganga/node_modules/hexo/lib/hexo/router.js:134:3)                                            
    at RouteStream.Readable.read (_stream_readable.js:442:10)                                                                                     
INFO  Generated: search.json

SukkaW commented 5 years ago

Try to update NodeJS to 10.0 and try again?

dragonJACson commented 5 years ago

I noticed that the doc had been updated, so I added a page for search as the doc says, then it works.

Thanks for your help!