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

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.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 24 (6 by maintainers)

Most upvoted comments

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

同样的出现了这个问题,同时编辑两篇文章,然后无法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)

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

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

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.

@sunnogo try something like

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

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

try use raw,like:

{% raw %}

{% sometag %}

{% endraw %}

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.