hexo icon indicating copy to clipboard operation
hexo copied to clipboard

`hexo server` error when I change the config

Open breestealth opened this issue 9 years ago • 10 comments

I change the config file to this one(just for the changed parts):

# Writing
new_post_name: :year:month:day.md # File name of new posts

In this way, when I add a new post, the post file name would be like this "20150310.md"

However, when I run hexo server I will got an error like this:

ERROR Process failed: _posts/20140130.md
ValidationError: `slug` is required!
    at SchemaTypeString.SchemaType.validate (/Users/xxxxx/Documents/blog/node_modules/hexo/node_modules/warehouse/lib/schematype.js:125:12)
    at SchemaTypeString.validate (/Users/xxxxx/Documents/blog/node_modules/hexo/node_modules/warehouse/lib/types/string.js:49:45)
    at Array.<anonymous> (/Users/xxxxx/Documents/blog/node_modules/hexo/node_modules/warehouse/lib/schema.js:198:23)
    at Schema._applySetters (/Users/xxxxx/Documents/blog/node_modules/hexo/node_modules/warehouse/lib/schema.js:369:19)
    at /Users/xxxxx/Documents/blog/node_modules/hexo/node_modules/warehouse/lib/model.js:229:24
    at tryCatcher (/Users/xxxxx/Documents/blog/node_modules/hexo/node_modules/bluebird/js/main/util.js:24:31)
    at Promise._settlePromiseFromHandler (/Users/xxxxx/Documents/blog/node_modules/hexo/node_modules/bluebird/js/main/promise.js:454:31)
    at Promise._settlePromiseAt (/Users/xxxxx/Documents/blog/node_modules/hexo/node_modules/bluebird/js/main/promise.js:530:18)
    at Promise._settlePromiseAtPostResolution (/Users/xxxxx/Documents/blog/node_modules/hexo/node_modules/bluebird/js/main/promise.js:224:10)
    at Async._drainQueue (/Users/xxxxx/Documents/blog/node_modules/hexo/node_modules/bluebird/js/main/async.js:84:12)
    at Async._drainQueues (/Users/xxxxx/Documents/blog/node_modules/hexo/node_modules/bluebird/js/main/async.js:89:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/xxxxx/Documents/blog/node_modules/hexo/node_modules/bluebird/js/main/async.js:14:14)
    at processImmediate [as _immediateCallback] (timers.js:358:17)

I run hexo clean before every other command. So there would be nothing about the cache.

breestealth avatar Mar 10 '15 05:03 breestealth

@breestealth Hello, problem still exist?

Xuanwo avatar Dec 15 '15 16:12 Xuanwo

i also have this problem.And when i add a new post,and after hexo g d,could not synchronise to my github

XieJunhua avatar Jan 24 '16 07:01 XieJunhua

hello , this problem also exists.

cjYao avatar Sep 02 '16 05:09 cjYao

I alse have this problem. And I'm only new a post on my pc.

e29hz avatar Sep 05 '16 10:09 e29hz

Hi, I also have this problem. and when I restore the new_post_name to ":titile.md", the error is gone. Maybe ":year:month:day.md" will name the file repeatedly? Do you resolve this problerm?

souvenir13 avatar Apr 25 '17 14:04 souvenir13

@souvenir13 Thanks! the problem disappeared after I changed back to ":titile.md"!

USnb5 avatar Jan 11 '18 06:01 USnb5

I believe the answer lies somewhere around here: https://github.com/hexojs/hexo/blob/0b26940f7e0a35f6937b944012468bbf0d844010/lib/plugins/processor/post.js#L53

But I'm unable to understand why

tomap avatar Sep 15 '18 13:09 tomap

我改回titile.md也不报错了

Devil-C avatar May 30 '19 09:05 Devil-C

Reproduced in Hexo 5.2.0

stevenjoezhang avatar Mar 31 '20 05:03 stevenjoezhang

Hi, I also have this problem. and when I restore the new_post_name to ":titile.md", the error is gone. Maybe ":year:month:day.md" will name the file repeatedly? Do you resolve this problerm?

thanks

GoldAndRabbit avatar Sep 19 '20 14:09 GoldAndRabbit