Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hello-world.md lacks a date #53

Open
mdemoss opened this issue Nov 1, 2021 · 6 comments
Open

hello-world.md lacks a date #53

mdemoss opened this issue Nov 1, 2021 · 6 comments
Assignees

Comments

@mdemoss
Copy link

mdemoss commented Nov 1, 2021

err: Error: `NaN` is not a valid date!

Initializing a new blog and running the server results in an error because hello-world.md lacks a date.

Adding a date to source/_posts/hello-world.md resolves the issue.

hexo: 5.4.0
hexo-cli: 4.3.0
os: freebsd 12.2-RELEASE-p2
node: 14.17.6
v8: 8.4.371.23-node.76
uv: 1.41.0
zlib: 1.2.11
brotli: 1.0.9
ares: 1.17.1
modules: 83
nghttp2: 1.43.0
napi: 8
llhttp: 2.1.3
openssl: 1.1.1l
cldr: 39.0
icu: 69.1
tz: 2021a
unicode: 13.0
@tomap tomap self-assigned this Nov 1, 2021
@stevenjoezhang
Copy link
Member

I can't reproduce this issue, could you provide the complete call stack of the error?

@SukkaW
Copy link
Member

SukkaW commented Nov 2, 2021

Can't reproduce either. In fact, our unit test includes generating a dummy blog site with 500 posts (all without date). So I doubt if it is really related with Hexo.

@tomap
Copy link

tomap commented Nov 2, 2021

Freebsd might have something to do with the error?

@mdemoss
Copy link
Author

mdemoss commented Nov 2, 2021

What's the normal behavior? Is it meant to pull a date from the file system if there is none found in the front matter? It's reasonable to think that could have an OS-specific issue.

Posts created with hexo new have a date in the front matter and don't cause an issue.

Here is the full trace.

/h/p/hxblog> npx hexo list post
INFO  Validating config
INFO  Start processing
ERROR {
  err: Error: `NaN` is not a valid date!
      at SchemaTypeMoment.validate (/home/protected/hxblog/node_modules/hexo/lib/models/types/moment.js:31:13)
      at Array.<anonymous> (/home/protected/hxblog/node_modules/warehouse/lib/schema.js:510:27)
      at Schema._applySetters (/home/protected/hxblog/node_modules/warehouse/lib/schema.js:640:15)
      at _Model._insertOne (/home/protected/hxblog/node_modules/warehouse/lib/model.js:158:12)
      at /home/protected/hxblog/node_modules/warehouse/lib/model.js:179:63
      at tryCatcher (/home/protected/hxblog/node_modules/bluebird/js/release/util.js:16:23)
      at /home/protected/hxblog/node_modules/bluebird/js/release/using.js:185:26
      at tryCatcher (/home/protected/hxblog/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/home/protected/hxblog/node_modules/bluebird/js/release/promise.js:547:31)
      at Promise._settlePromise (/home/protected/hxblog/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromise0 (/home/protected/hxblog/node_modules/bluebird/js/release/promise.js:649:10)
      at Promise._settlePromises (/home/protected/hxblog/node_modules/bluebird/js/release/promise.js:729:18)
      at Promise._fulfill (/home/protected/hxblog/node_modules/bluebird/js/release/promise.js:673:18)
      at PromiseArray._resolve (/home/protected/hxblog/node_modules/bluebird/js/release/promise_array.js:127:19)
      at PromiseArray._promiseFulfilled (/home/protected/hxblog/node_modules/bluebird/js/release/promise_array.js:145:14)
      at Promise._settlePromise (/home/protected/hxblog/node_modules/bluebird/js/release/promise.js:609:26)
} Process failed: %s _posts/hello-world.md
/h/p/hxblog> npx hexo server -i 127.0.0.1
INFO  Validating config
INFO  Start processing
ERROR {
  err: Error: `NaN` is not a valid date!
      at SchemaTypeMoment.validate (/home/protected/hxblog/node_modules/hexo/lib/models/types/moment.js:31:13)
      at Array.<anonymous> (/home/protected/hxblog/node_modules/warehouse/lib/schema.js:510:27)
      at Schema._applySetters (/home/protected/hxblog/node_modules/warehouse/lib/schema.js:640:15)
      at _Model._insertOne (/home/protected/hxblog/node_modules/warehouse/lib/model.js:158:12)
      at /home/protected/hxblog/node_modules/warehouse/lib/model.js:179:63
      at tryCatcher (/home/protected/hxblog/node_modules/bluebird/js/release/util.js:16:23)
      at /home/protected/hxblog/node_modules/bluebird/js/release/using.js:185:26
      at tryCatcher (/home/protected/hxblog/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/home/protected/hxblog/node_modules/bluebird/js/release/promise.js:547:31)
      at Promise._settlePromise (/home/protected/hxblog/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromise0 (/home/protected/hxblog/node_modules/bluebird/js/release/promise.js:649:10)
      at Promise._settlePromises (/home/protected/hxblog/node_modules/bluebird/js/release/promise.js:729:18)
      at Promise._fulfill (/home/protected/hxblog/node_modules/bluebird/js/release/promise.js:673:18)
      at PromiseArray._resolve (/home/protected/hxblog/node_modules/bluebird/js/release/promise_array.js:127:19)
      at PromiseArray._promiseFulfilled (/home/protected/hxblog/node_modules/bluebird/js/release/promise_array.js:145:14)
      at Promise._settlePromise (/home/protected/hxblog/node_modules/bluebird/js/release/promise.js:609:26)
} Process failed: %s _posts/hello-world.md

@stevenjoezhang
Copy link
Member

However, it is commemorative to record the date of the hello world article (it is also the creation time of the blog site).
Maybe we can design a special hexo new command to run automatically after hexo init, to solve this issue

@uiolee
Copy link
Member

uiolee commented Apr 18, 2024

When no date is specified in front-matter, hexo uses the file date. If it fails, I'd guess it's probably related to file system and permissions. Please try to delete the file and rebuild it, or use another volume.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants