Hexo构建静态博客方法

一直使用Hexo+Github构建静态博客,可突然在使用hexo g -d命令时出故障了,问题如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
INFO  [hexo-math] Using engine 'mathjax'
INFO Start processing
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Template render error: expected variable end
at Object._prettifyError (F:\blog\node_modules\nunjucks\src\lib.js:35:11)
at Template.render (F:\blog\node_modules\nunjucks\src\environment.js:526:21)
at Environment.renderString (F:\blog\node_modules\nunjucks\src\environment.js:364:17)
at Promise.fromCallback.cb (F:\blog\node_modules\hexo\lib\extend\tag.js:62:48)
at tryCatcher (F:\blog\node_modules\bluebird\js\release\util.js:16:23)
at Function.Promise.fromNode.Promise.fromCallback (F:\blog\node_modules\bluebird\js\release\promise.js:180:30)
at Tag.render (F:\blog\node_modules\hexo\lib\extend\tag.js:62:18)
at Object.onRenderEnd (F:\blog\node_modules\hexo\lib\hexo\post.js:282:20)
at Promise.then.then.result (F:\blog\node_modules\hexo\lib\hexo\render.js:65:19)
at tryCatcher (F:\blog\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (F:\blog\node_modules\bluebird\js\release\promise.js:512:31)
at Promise._settlePromise (F:\blog\node_modules\bluebird\js\release\promise.js:569:18)
at Promise._settlePromise0 (F:\blog\node_modules\bluebird\js\release\promise.js:614:10)
at Promise._settlePromises (F:\blog\node_modules\bluebird\js\release\promise.js:693:18)
at Async._drainQueue (F:\blog\node_modules\bluebird\js\release\async.js:133:16)
at Async._drainQueues (F:\blog\node_modules\bluebird\js\release\async.js:143:10)
at Immediate.Async.drainQueues (F:\blog\node_modules\bluebird\js\release\async.js:17:14)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)

不想在费劲的查找问题原因,打算重新走一遍hexo+github构建博客流程,于是记录一下。

Hexo安装

Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown(或其他渲染引擎)解析文章,在几秒内,即可利用靓丽的主题生成静态网页。安装Hexo命令如下:

1
2
3
4
5
6
7
8
npm install hexo-cli -g
hexo init blog
cd blog
npm install
hexo server

// Solve ERROR Deployer not found: git
npm install hexo-deployer-git --save

后记

安装最新版本的Hexo之后,发现还是出现文章开始的错误,不过幸运的是,新版本的Hexo给出了错误的位置,经检查是公式输入不对导致解析错误的原因。

参考链接

  1. hexo,by hexo.
  2. 超详细Hexo+Github博客搭建小白教程,by 韦阳.
  3. GitHub+Hexo 搭建个人网站详细教程,by 吴润.
  4. ERROR Deployer not found: git,by hexo.