遇到错误
- 报错信息如下:
@lenovo ➜ blog git:(master) ✗ hexo g
INFO Start processing
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Template render error: (unknown path)
Error: expected end of comment, got end of file
at Object._prettifyError (/old/blog/node_modules/nunjucks/src/lib.js:36:11)
at Template.render (/old/blog/node_modules/nunjucks/src/environment.js:542:21)
at Environment.renderString (/old/blog/node_modules/nunjucks/src/environment.js:380:17)
at /old/blog/node_modules/hexo/lib/extend/tag.js:123:48
at tryCatcher (/old/blog/node_modules/bluebird/js/release/util.js:16:23)
at Function.Promise.fromNode.Promise.fromCallback (/old/blog/node_modules/bluebird/js/release/promise.js:185:30)
at Tag.render (/old/blog/node_modules/hexo/lib/extend/tag.js:123:18)
at Object.onRenderEnd (/old/blog/node_modules/hexo/lib/hexo/post.js:280:20)
at /old/blog/node_modules/hexo/lib/hexo/render.js:64:19
at tryCatcher (/old/blog/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/old/blog/node_modules/bluebird/js/release/promise.js:517:31)
at Promise._settlePromise (/old/blog/node_modules/bluebird/js/release/promise.js:574:18)
at Promise._settlePromise0 (/old/blog/node_modules/bluebird/js/release/promise.js:619:10)
at Promise._settlePromises (/old/blog/node_modules/bluebird/js/release/promise.js:699:18)
at _drainQueueStep (/old/blog/node_modules/bluebird/js/release/async.js:138:12)
at _drainQueue (/old/blog/node_modules/bluebird/js/release/async.js:131:9)
at Async._drainQueues (/old/blog/node_modules/bluebird/js/release/async.js:147:5)
at Immediate.Async.drainQueues (/old/blog/node_modules/bluebird/js/release/async.js:17:14)
at processImmediate (internal/timers.js:439:21)
解决问题
- 问题主要出在 md 文件,也就是我们要发布的文章中。文章首部位置是声明文章元信息的地方,有着特殊的书写规范
---
title: title
categories: categories
tags: tag
date: date
---
就如同上面的那样,总结就是:
- 必须以
- - -
这个符号开始或结束 - 上面的参数像 key: value 这样子对应,其中最重要的就是冒号和alue之间
必须要空一格
- 对于 value 值也是有硬性要求的,不能包括一些特殊字符和中文字符,有的话看看是不是那个问题(我的问题就出在这里了:T)
- 我遇到的特殊符号包括如下:
[ ]
{ }
( )
...
更多特殊字符可以参考 Hexo 中 Markdown 特殊字符的处理方法