hexo generate fail - Template render error: (unknown path)

Created on 16 Mar 2016  ·  24Comments  ·  Source: hexojs/hexo

Hi

I'm using hexo 3.2.0

hexo: 3.2.0
hexo-cli: 1.0.1
os: Linux 4.1.15-8-default linux x64
http_parser: 2.5.2
node: 4.3.1
v8: 4.5.103.35
uv: 1.8.0
zlib: 1.2.8
ares: 1.10.1-DEV
modules: 46
openssl: 1.0.2f

and I can't generate my files anymore.

When I run hexo g I have an error :

hexo g
INFO  Start processing
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Template render error: (unknown path) [Line 2, Column 2]
  unknown block tag: alert
    at Object.exports.prettifyError (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/nunjucks/src/lib.js:34:15)
    at Obj.extend.render (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/nunjucks/src/environment.js:468:27)
    at Obj.extend.renderString (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/nunjucks/src/environment.js:326:21)
    at /run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/lib/extend/tag.js:66:9
    at Promise._execute (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/debuggability.js:272:9)
    at Promise._resolveFromExecutor (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:474:18)
    at new Promise (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:77:14)
    at Tag.render (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/lib/extend/tag.js:64:10)
    at Object.tagFilter [as onRenderEnd] (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/lib/hexo/post.js:253:16)
    at /run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/lib/hexo/render.js:63:19
    at tryCatcher (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:503:31)
    at Promise._settlePromise (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:560:18)
    at Promise._settlePromise0 (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:605:10)
    at Promise._settlePromises (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:684:18)
    at Async._drainQueue (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/async.js:126:16)
    at Async._drainQueues (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/async.js:136:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/async.js:16:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)
FATAL (unknown path) [Line 2, Column 2]
  unknown block tag: alert
Template render error: (unknown path) [Line 2, Column 2]
  unknown block tag: alert
    at Object.exports.prettifyError (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/nunjucks/src/lib.js:34:15)
    at Obj.extend.render (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/nunjucks/src/environment.js:468:27)
    at Obj.extend.renderString (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/nunjucks/src/environment.js:326:21)
    at /run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/lib/extend/tag.js:66:9
    at Promise._execute (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/debuggability.js:272:9)
    at Promise._resolveFromExecutor (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:474:18)
    at new Promise (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:77:14)
    at Tag.render (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/lib/extend/tag.js:64:10)
    at Object.tagFilter [as onRenderEnd] (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/lib/hexo/post.js:253:16)
    at /run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/lib/hexo/render.js:63:19
    at tryCatcher (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:503:31)
    at Promise._settlePromise (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:560:18)
    at Promise._settlePromise0 (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:605:10)
    at Promise._settlePromises (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:684:18)
    at Async._drainQueue (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/async.js:126:16)
    at Async._drainQueues (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/async.js:136:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/run/media/shark/Media/CrossPlatform/www/hexo_test/node_modules/hexo/node_modules/bluebird/js/release/async.js:16:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)

I tried hexo clean and the hexo g but still have the same.

If I hexo init a new blog I can use hexo g but in my current one I can't.

I also tried to replace my _config.yml by the default one but can generate too.

Most helpful comment

同样的出现了这个问题,同时编辑两篇文章,然后无法run了。两边文章轮流删除,锁定在这篇文章。命令行就简单的这样提示说可以去hexo官网查看。还真的是因为在代码块中使用了双花括号,{{}},使用这个会让markdown文件出错,在花括号中间随便写了一个单词{{massage}}就解决了。

出错语句:### {{}}、v-text、v-html data数据双向绑定指令

然后才反应过来,命令行其实已经明明白白告诉告诉我原因了,我还一直纠结它说的第5行。小白入门真的是要慢慢爬。

FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting
Template render error: (unknown path) [Line 5, Column 235]
unexpected token: }}
at Object._prettifyError (E:xiaomiblognode_modules\nunjuckssrclib.js:36:11)
at Template.render (E:xiaomiblognode_modules\nunjuckssrc\environment.js:524:21)
at Environment.renderString (E:xiaomiblognode_modules\nunjuckssrc\environment.js:362:17)
at Promise (E:xiaomiblognode_modules\hexolib\extend\tag.js:66:9)

第三行明明白白的告诉我它理解不了我的符号 }}

在这里回复记录一下自己的小白时刻。

All 24 comments

This error indicate a syntax error in one of your post/page file.
To find which one, try hexo generate --debug

If you can't find the error in that file (has to do with an 'alert' block tag), post the file content here.

The hexo generate --debug didn't help me at all but I find why !

Before the bug I used tranquilpeak theme and in one of my post I used something like :

{% alert danger no-icon %}
Here is a danger alert without icon
{% endalert %}

but this theme-specific tag don't work with other themes.

In fact when I changed my theme in _config.yml from tranquilpeak to another I generated this bug.

So I have to remove the tags or continue to use tranquilpeak themes. But is there another way to continue using the tags and make it works with all themes ?

You can copy the alert.js file from here into your own scripts folder (in the root of your hexo project).

But that will not style the resulting <div>. For that, you'd need to add the content of _alert.scss from here into your own scss. Not sure how you could accomplish that so that it applies to any theme you might use.
You might need to include it in the current theme's scss files somehow.

That mean I need to copy _alert.scss and alert.js in all themes I want to try. And that's not sure that will work everywhere.

Maybe the better thing to do is to use hexo-tag-bootstrap plugin wich also have an alert tag. With this plugin this will work everywhere.

Thanks anyway for your idea, it was a good idea

As you can see here tags name are exactly the sames so I even do'nt have to change them.

Just by installing hexo-tag-bootstrap I make it work again.

Thans for your help ;)

PS : The hexo-tag-boostrap just provide scripts but no css

I cannot find which page is wrong, and it's really inconvenient to delete recent pages separately to checkout which page is wrong.

@sunnogo try something like

$ grep -r '{%' /hexo_dir/sources/

to find is this pattern is present in one of your source files.

@noraj1337 Thanks for your reply.

I don't have a '{%' in markdown text, but I find that the statement below causes the error.

`{{indexmenu>..#2|navbar nocookie}}`

I have no idea with front-end and render, maybe it's a new issue.

Finally, I find that pattern {{ (a double '{') causes the error.

@gboudreau Template render error: (unknown path) [Line 11, Column 16385] unexpected token: # at Object.exports.prettifyError (F:\Blog\Tysontx.github.io\node_modules\nunjucks\src\lib.js:34:15) at new_cls.render (F:\Blog\Tysontx.github.io\node_modules\nunjucks\src\environment.js:469:27) at new_cls.renderString (F:\Blog\Tysontx.github.io\node_modules\nunjucks\src\environment.js:327:21) at F:\Blog\Tysontx.github.io\node_modules\hexo\lib\extend\tag.js:66:9 at Promise._execute (F:\Blog\Tysontx.github.io\node_modules\bluebird\js\release\debuggability.js:300:9) at Promise._resolveFromExecutor (F:\Blog\Tysontx.github.io\node_modules\bluebird\js\release\promise.js:483:18) at new Promise (F:\Blog\Tysontx.github.io\node_modules\bluebird\js\release\promise.js:79:10) at Tag.render (F:\Blog\Tysontx.github.io\node_modules\hexo\lib\extend\tag.js:64:10) at Object.tagFilter [as onRenderEnd] (F:\Blog\Tysontx.github.io\node_modules\hexo\lib\hexo\post.js:266:16) at F:\Blog\Tysontx.github.io\node_modules\hexo\lib\hexo\render.js:65:19 at tryCatcher (F:\Blog\Tysontx.github.io\node_modules\bluebird\js\release\util.js:16:23) at Promise._settlePromiseFromHandler (F:\Blog\Tysontx.github.io\node_modules\bluebird\js\release\promise.js:512:31) at Promise._settlePromise (F:\Blog\Tysontx.github.io\node_modules\bluebird\js\release\promise.js:569:18) at Promise._settlePromise0 (F:\Blog\Tysontx.github.io\node_modules\bluebird\js\release\promise.js:614:10) at Promise._settlePromises (F:\Blog\Tysontx.github.io\node_modules\bluebird\js\release\promise.js:693:18) at Async._drainQueue (F:\Blog\Tysontx.github.io\node_modules\bluebird\js\release\async.js:133:16) at Async._drainQueues (F:\Blog\Tysontx.github.io\node_modules\bluebird\js\release\async.js:143:10) at Immediate.Async.drainQueues (F:\Blog\Tysontx.github.io\node_modules\bluebird\js\release\async.js:17:14) at runCallback (timers.js:672:20) at tryOnImmediate (timers.js:645:5) at processImmediate [as _immediateCallback] (timers.js:617:5) 15:17:15.904 DEBUG Database saved

@gboudreau Hope to get your reply! Thank you!

[root@host myhexo]# hexo generate --debug

/usr/myhexo/node_modules/hexo/lib/extend/tag.js:184
body((err, result) => {
^
07:32:54.948 ERROR Local hexo not found in /usr/myhexo
07:32:54.953 ERROR Try running: 'npm install hexo --save'

I've got the same question,and I've tried to reinstall the npm,or check the __config.yml but find notiong wrong. Sad...

@superarm i meet the same problem,did u solve it?

@superarm @lululu811 我也遇到这个问题,我的解决方法是升级node到最新版就可以了

I encontered the same problem when I use two {, just put a space in them. My issue was solved.

同样的出现了这个问题,同时编辑两篇文章,然后无法run了。两边文章轮流删除,锁定在这篇文章。命令行就简单的这样提示说可以去hexo官网查看。还真的是因为在代码块中使用了双花括号,{{}},使用这个会让markdown文件出错,在花括号中间随便写了一个单词{{massage}}就解决了。

出错语句:### {{}}、v-text、v-html data数据双向绑定指令

然后才反应过来,命令行其实已经明明白白告诉告诉我原因了,我还一直纠结它说的第5行。小白入门真的是要慢慢爬。

FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting
Template render error: (unknown path) [Line 5, Column 235]
unexpected token: }}
at Object._prettifyError (E:xiaomiblognode_modules\nunjuckssrclib.js:36:11)
at Template.render (E:xiaomiblognode_modules\nunjuckssrc\environment.js:524:21)
at Environment.renderString (E:xiaomiblognode_modules\nunjuckssrc\environment.js:362:17)
at Promise (E:xiaomiblognode_modules\hexolib\extend\tag.js:66:9)

第三行明明白白的告诉我它理解不了我的符号 }}

在这里回复记录一下自己的小白时刻。

加油!!!

出错的符号,能不能在js里 log一下?

try use raw,like:

{% raw %}

{% sometag %}

{% endraw %}

i encoutered the same problem,i use the hexo generate --debug,the info the below

03:57:09.683 FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Template render error: (unknown path) [Line 32, Column 13]
  expected variable end
    at Object._prettifyError (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@nunjucks/src/lib.js:36:11)
    at Template.render (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@nunjucks/src/environment.js:542:21)
    at Environment.renderString (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@nunjucks/src/environment.js:380:17)
    at Promise.fromCallback.cb (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@hexo/lib/extend/tag.js:62:48)
    at tryCatcher (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@bluebird/js/release/util.js:16:23)
    at Function.Promise.fromNode.Promise.fromCallback (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@bluebird/js/release/promise.js:180:30)
    at Tag.render (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@hexo/lib/extend/tag.js:62:18)
    at Object.onRenderEnd (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@hexo/lib/hexo/post.js:282:20)
    at Promise.then.then.result (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@hexo/lib/hexo/render.js:65:19)
    at tryCatcher (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@bluebird/js/release/promise.js:694:18)
    at _drainQueueStep (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@bluebird/js/release/async.js:138:12)
    at _drainQueue (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/[email protected]@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)

i can't found the exact problem, bug refer to hexo 错误汇总 i found it may be is the new post's problem

finally i solved the problem, it's about the latex math syntax is conflict with hexo

Template render error: (unknown path)
  Error: template not found: _custom/custom.swig
    at Object.exports.prettifyError (E:\MyCode\cherrykeinz.github.io\node_modules\nunjucks\src\lib.js:34:15)
    at E:\MyCode\cherrykeinz.github.io\node_modules\nunjucks\src\environment.js:486:31
    at eval (eval at _compile (E:\MyCode\cherrykeinz.github.io\node_modules\nunjucks\src\environment.js:565:24), <anonymous>:20:11)
    at createTemplate (E:\MyCode\cherrykeinz.github.io\node_modules\nunjucks\src\environment.js:212:25)
    at next (E:\MyCode\cherrykeinz.github.io\node_modules\nunjucks\src\lib.js:210:13)
    at handle (E:\MyCode\cherrykeinz.github.io\node_modules\nunjucks\src\environment.js:252:25)
    at E:\MyCode\cherrykeinz.github.io\node_modules\nunjucks\src\environment.js:263:21
    at next (E:\MyCode\cherrykeinz.github.io\node_modules\nunjucks\src\lib.js:207:13)
    at Object.exports.asyncIter (E:\MyCode\cherrykeinz.github.io\node_modules\nunjucks\src\lib.js:214:5)
    at new_cls.getTemplate (E:\MyCode\cherrykeinz.github.io\node_modules\nunjucks\src\environment.js:242:17)
    at new_cls.root [as rootRenderFunc] (eval at _compile (E:\MyCode\cherrykeinz.github.io\node_modules\nunjucks\src\environment.js:565:24), <anonymous>:19:5)
    at new_cls.render (E:\MyCode\cherrykeinz.github.io\node_modules\nunjucks\src\environment.js:479:15)
    at new_cls.renderString (E:\MyCode\cherrykeinz.github.io\node_modules\nunjucks\src\environment.js:327:21)
    at E:\MyCode\cherrykeinz.github.io\node_modules\hexo\lib\extend\tag.js:66:9
    at Promise._execute (E:\MyCode\cherrykeinz.github.io\node_modules\bluebird\js\release\debuggability.js:303:9)
    at Promise._resolveFromExecutor (E:\MyCode\cherrykeinz.github.io\node_modules\bluebird\js\release\promise.js:483:18)
    at new Promise (E:\MyCode\cherrykeinz.github.io\node_modules\bluebird\js\release\promise.js:79:10)
    at Tag.render (E:\MyCode\cherrykeinz.github.io\node_modules\hexo\lib\extend\tag.js:64:10)
    at Object.tagFilter [as onRenderEnd] (E:\MyCode\cherrykeinz.github.io\node_modules\hexo\lib\hexo\post.js:266:16)
    at E:\MyCode\cherrykeinz.github.io\node_modules\hexo\lib\hexo\render.js:65:19
    at tryCatcher (E:\MyCode\cherrykeinz.github.io\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (E:\MyCode\cherrykeinz.github.io\node_modules\bluebird\js\release\promise.js:512:31)

遇到这个问题,原来是文章中,
themes\next\layout\_custom\custom.swig
没有放到代码段里

same problem. I find can not use {{ or }} in latex, so i modify {{ -> { { , }} -> } } sovle problem.

@sunnogo try something like

$ grep -r '{%' /hexo_dir/sources/

to find is this pattern is present in one of your source files.

It's a good solution.The reason of this problem is special symbol in post.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jakeg picture jakeg  ·  3Comments

19uni94 picture 19uni94  ·  3Comments

awulkan picture awulkan  ·  3Comments

lushijie picture lushijie  ·  3Comments

ghost picture ghost  ·  3Comments