0%

hexo问题

hexo-generator-searchdb问题

Cannot read property ‘order_by’ of undefined

执行 npx hexo server时出现错误

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
TypeError: Cannot read property 'order_by' of undefined
at module.exports (/Users/duanzq/blog/node_modules/hexo-generator-searchdb/lib/database.js:49:46)
at Hexo.module.exports (/Users/duanzq/blog/node_modules/hexo-generator-searchdb/lib/xml_generator.js:13:39)
at Hexo.tryCatcher (/Users/duanzq/blog/node_modules/bluebird/js/release/util.js:16:23)
at Hexo.<anonymous> (/Users/duanzq/blog/node_modules/bluebird/js/release/method.js:15:34)
at /Users/duanzq/blog/node_modules/hexo/lib/hexo/index.js:318:20
at tryCatcher (/Users/duanzq/blog/node_modules/bluebird/js/release/util.js:16:23)
at MappingPromiseArray._promiseFulfilled (/Users/duanzq/blog/node_modules/bluebird/js/release/map.js:68:38)
at MappingPromiseArray.PromiseArray._iterate (/Users/duanzq/blog/node_modules/bluebird/js/release/promise_array.js:115:31)
at MappingPromiseArray.init (/Users/duanzq/blog/node_modules/bluebird/js/release/promise_array.js:79:10)
at MappingPromiseArray._asyncInit (/Users/duanzq/blog/node_modules/bluebird/js/release/map.js:37:10)
at _drainQueueStep (/Users/duanzq/blog/node_modules/bluebird/js/release/async.js:97:12)
at _drainQueue (/Users/duanzq/blog/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/Users/duanzq/blog/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/duanzq/blog/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:439:21)

image-20200104221819032

原因是hexo-generator-searchdb/lib/database.js中读取config.index_generator.order_by

image-20200104222204883

在使用hexo-generator-index2时没有配置 index 属性,增加该配置解决

image-20200104222450387