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

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

Closed
noraj opened this issue Mar 16, 2016 · 24 comments
Closed

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

noraj opened this issue Mar 16, 2016 · 24 comments

Comments

@noraj
Copy link
Contributor

noraj commented Mar 16, 2016

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.

@gboudreau
Copy link

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.

@noraj
Copy link
Contributor Author

noraj commented Mar 16, 2016

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 ?

@gboudreau
Copy link

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.

@noraj
Copy link
Contributor Author

noraj commented Mar 16, 2016

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

@noraj
Copy link
Contributor Author

noraj commented Mar 16, 2016

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 ;)

@noraj noraj closed this as completed Mar 16, 2016
@noraj
Copy link
Contributor Author

noraj commented Mar 16, 2016

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

@jeromesun14
Copy link

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

@noraj
Copy link
Contributor Author

noraj commented Apr 11, 2017

@sunnogo try something like

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

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

@jeromesun14
Copy link

jeromesun14 commented Apr 12, 2017

@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.

@jeromesun14
Copy link

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

@Tysontx
Copy link

Tysontx commented Jul 29, 2017

@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

@Tysontx
Copy link

Tysontx commented Jul 29, 2017

@gboudreau Hope to get your reply! Thank you!

@superarm
Copy link

[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...

@lululu811
Copy link

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

@yuchuanfeng
Copy link

yuchuanfeng commented Aug 25, 2017

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

@hjyai94
Copy link

hjyai94 commented May 9, 2018

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

@xiaomizhou66
Copy link

同样的出现了这个问题,同时编辑两篇文章,然后无法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:\xiaomiblog\node_modules\nunjucks\src\lib.js:36:11)
at Template.render (E:\xiaomiblog\node_modules\nunjucks\src\environment.js:524:21)
at Environment.renderString (E:\xiaomiblog\node_modules\nunjucks\src\environment.js:362:17)
at Promise (E:\xiaomiblog\node_modules\hexo\lib\extend\tag.js:66:9)

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

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

@hjyai94
Copy link

hjyai94 commented Aug 23, 2018

加油!!!

@xu-song
Copy link
Contributor

xu-song commented Oct 25, 2018

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

@victoryofymk
Copy link

try use raw,like:

{% raw %}

{% sometag %}

{% endraw %}

@zjZSTU
Copy link

zjZSTU commented May 4, 2019

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/_nunjucks@3.2.0@nunjucks/src/lib.js:36:11)
    at Template.render (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/_nunjucks@3.2.0@nunjucks/src/environment.js:542:21)
    at Environment.renderString (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/_nunjucks@3.2.0@nunjucks/src/environment.js:380:17)
    at Promise.fromCallback.cb (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/_hexo@3.8.0@hexo/lib/extend/tag.js:62:48)
    at tryCatcher (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/_bluebird@3.5.4@bluebird/js/release/util.js:16:23)
    at Function.Promise.fromNode.Promise.fromCallback (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/_bluebird@3.5.4@bluebird/js/release/promise.js:180:30)
    at Tag.render (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/_hexo@3.8.0@hexo/lib/extend/tag.js:62:18)
    at Object.onRenderEnd (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/_hexo@3.8.0@hexo/lib/hexo/post.js:282:20)
    at Promise.then.then.result (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/_hexo@3.8.0@hexo/lib/hexo/render.js:65:19)
    at tryCatcher (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/_bluebird@3.5.4@bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/_bluebird@3.5.4@bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/_bluebird@3.5.4@bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/_bluebird@3.5.4@bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/_bluebird@3.5.4@bluebird/js/release/promise.js:694:18)
    at _drainQueueStep (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/_bluebird@3.5.4@bluebird/js/release/async.js:138:12)
    at _drainQueue (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/_bluebird@3.5.4@bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/_bluebird@3.5.4@bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues (/home/zj/Documents/zjzstu.github.com/blogs/node_modules/_bluebird@3.5.4@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

@LostEvangel
Copy link

LostEvangel commented Jun 25, 2019

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
没有放到代码段里

@zhen8838
Copy link

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

@0xwang-coder
Copy link

@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.

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