hexojs / hexo

A fast, simple & powerful blog framework, powered by Node.js.
https://hexo.io
MIT License
39.54k stars 4.86k forks source link

couldn't generate the article and throw exceptions #2219

Closed zhangtianle closed 8 years ago

zhangtianle commented 8 years ago

When I had finished an article,used hexo g or hexo s command to generate the article ,and thrown an exception 。And then I deleted this article and typed the command hexo g,there was no problem。Could you tell me whether my article format has a problem? for instance, using some special characters, and I can't find out the problem. Thank you!

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)
  SyntaxError: Unexpected token ILLEGAL
    at Object.exports.prettifyError (D:\project\git\blog\node_modules\hexo\node_modules\nunjucks\src\lib.js:34:15)
    at Obj.extend.render (D:\project\git\blog\node_modules\hexo\node_modules\nunjucks\src\environment.js:469:27)
    at Obj.extend.renderString (D:\project\git\blog\node_modules\hexo\node_modules\nunjucks\src\environment.js:327:21)
    at D:\project\git\blog\node_modules\hexo\lib\extend\tag.js:66:9
    at Promise._execute (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\debuggability.js:299:9)
    at Promise._resolveFromExecutor (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:4
81:18)
    at new Promise (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:77:14)
    at Tag.render (D:\project\git\blog\node_modules\hexo\lib\extend\tag.js:64:10)
    at Object.tagFilter [as onRenderEnd] (D:\project\git\blog\node_modules\hexo\lib\hexo\post.js:253:16)
    at D:\project\git\blog\node_modules\hexo\lib\hexo\render.js:65:19
    at tryCatcher (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise
.js:510:31)
    at Promise._settlePromise (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:567:18)
    at Promise._settlePromise0 (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:612:10
)
    at Promise._settlePromises (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:691:18
)
    at Async._drainQueue (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\async.js:138:16)
    at Async._drainQueues (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\async.js:148:10)
    at Immediate.Async.drainQueues [as _onImmediate] (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\rel
ease\async.js:17:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)
FATAL (unknown path)
  SyntaxError: Unexpected token ILLEGAL
Template render error: (unknown path)
  SyntaxError: Unexpected token ILLEGAL
    at Object.exports.prettifyError (D:\project\git\blog\node_modules\hexo\node_modules\nunjucks\src\lib.js:34:15)
    at Obj.extend.render (D:\project\git\blog\node_modules\hexo\node_modules\nunjucks\src\environment.js:469:27)
    at Obj.extend.renderString (D:\project\git\blog\node_modules\hexo\node_modules\nunjucks\src\environment.js:327:21)
    at D:\project\git\blog\node_modules\hexo\lib\extend\tag.js:66:9
    at Promise._execute (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\debuggability.js:299:9)
    at Promise._resolveFromExecutor (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:4
81:18)
    at new Promise (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:77:14)
    at Tag.render (D:\project\git\blog\node_modules\hexo\lib\extend\tag.js:64:10)
    at Object.tagFilter [as onRenderEnd] (D:\project\git\blog\node_modules\hexo\lib\hexo\post.js:253:16)
    at D:\project\git\blog\node_modules\hexo\lib\hexo\render.js:65:19
    at tryCatcher (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise
.js:510:31)
    at Promise._settlePromise (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:567:18)
    at Promise._settlePromise0 (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:612:10
)
    at Promise._settlePromises (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:691:18
)
    at Async._drainQueue (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\async.js:138:16)
    at Async._drainQueues (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\async.js:148:10)
    at Immediate.Async.drainQueues [as _onImmediate] (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\rel
ease\async.js:17:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)
pirtleshell commented 8 years ago

Were you able to reproduce this by adding the post again? If so, can you provide an example of post markdown content that causes the error?

Neveryu commented 8 years ago

I agree with the view above.

zhangtianle commented 8 years ago

Thank you!This is my file.spring-transaction.md

pirtleshell commented 8 years ago

Hmm.. It renders for me with your config (although on a different theme). It recognizes the category and the three tags. What are the results of running

hexo -v

hexo clean
hexo generate --debug

If the problem persists, you should try changing your theme back to the default to see if the problem could be there.

zhangtianle commented 8 years ago

Thank you very much for your patience to help, but I try to use the default theme, unfortunately the error occurred. config

hexo: 3.2.2 hexo-cli: 1.0.2 os: Windows_NT 10.0.14393 win32 x64 http_parser: 2.7.0 node: 4.6.1 v8: 4.5.103.37 uv: 1.9.1 zlib: 1.2.8 ares: 1.10.1-DEV icu: 56.1 modules: 46 openssl: 1.0.2j

14:33:02.639 DEBUG Hexo version: 3.2.2
14:33:02.644 DEBUG Working directory: D:\project\git\blog\
14:33:02.945 DEBUG Config loaded: D:\project\git\blog\_config.yml
14:33:02.987 DEBUG Script loaded: themes\landscape\scripts\fancybox.js
14:33:03.444 DEBUG Plugin loaded: hexo-deployer-git
14:33:03.459 DEBUG Plugin loaded: hexo-generator-archive
14:33:03.474 DEBUG Plugin loaded: hexo-generator-baidu-sitemap
14:33:03.540 DEBUG Plugin loaded: hexo-generator-feed
14:33:03.552 DEBUG Plugin loaded: hexo-generator-category
14:33:03.562 DEBUG Plugin loaded: hexo-generator-index
14:33:03.753 DEBUG Plugin loaded: hexo-generator-searchdb
14:33:03.765 DEBUG Plugin loaded: hexo-generator-sitemap
14:33:03.777 DEBUG Plugin loaded: hexo-generator-tag
14:33:03.790 DEBUG Plugin loaded: hexo-renderer-ejs
14:33:03.991 DEBUG Plugin loaded: hexo-renderer-marked
14:33:03.996 DEBUG Plugin loaded: hexo-renderer-stylus
14:33:04.226 DEBUG Plugin loaded: hexo-server
14:33:04.229 DEBUG Loading database.
14:33:04.241 INFO  Start processing
14:33:04.294 DEBUG Processed: default_avatar.jpg
14:33:04.350 DEBUG Processed: img/1.gif
14:33:04.352 DEBUG Processed: img/title.gif
14:33:04.381 DEBUG Processed: img/weixin.png
14:33:04.406 DEBUG Theme config loaded.
14:33:04.408 DEBUG Processed: _config.yml
14:33:04.410 DEBUG Processed: img/20151217/chat1.png
14:33:04.412 DEBUG Processed: img/20151217/chat2.png
14:33:04.413 DEBUG Processed: img/20151217/chat3.png
14:33:04.415 DEBUG Processed: img/20151217/login1.png
14:33:04.421 DEBUG Processed: img/20151217/logout.png
14:33:04.425 DEBUG Processed: img/20151217/register.png
14:33:04.427 DEBUG Processed: img/20151217/spring.png
14:33:04.429 DEBUG Processed: img/20160429/1.png
14:33:04.433 DEBUG Processed: img/20160429/2.jpg
14:33:04.434 DEBUG Processed: img/20160429/3.jpg
14:33:04.435 DEBUG Processed: img/20160429/4.jpg
14:33:04.437 DEBUG Processed: img/20160529/PSO.gif
14:33:04.450 DEBUG Processed: source/css/style.styl
14:33:04.451 DEBUG Processed: source/fancybox/blank.gif
14:33:04.453 DEBUG Processed: source/fancybox/fancybox_loading.gif
14:33:04.454 DEBUG Processed: source/fancybox/fancybox_loading@2x.gif
14:33:04.456 DEBUG Processed: source/fancybox/fancybox_overlay.png
14:33:04.458 DEBUG Processed: source/fancybox/fancybox_sprite.png
14:33:04.460 DEBUG Processed: source/fancybox/fancybox_sprite@2x.png
14:33:04.461 DEBUG Processed: source/fancybox/jquery.fancybox.css
14:33:04.462 DEBUG Processed: source/fancybox/jquery.fancybox.js
14:33:04.463 DEBUG Processed: source/fancybox/jquery.fancybox.pack.js
14:33:04.464 DEBUG Processed: source/js/script.js
14:33:04.496 DEBUG Processed: about/index.md
14:33:04.503 DEBUG Processed: img/20160822/1.jpg
14:33:04.505 DEBUG Processed: img/20160822/2.jpg
14:33:04.510 DEBUG Processed: img/20160822/3.jpg
14:33:04.512 DEBUG Processed: img/20160822/4.jpg
14:33:04.514 DEBUG Processed: img/20160822/6.jpg
14:33:04.517 DEBUG Processed: img/alipay.jpg
14:33:04.519 DEBUG Processed: img/20160822/7.jpg
14:33:04.520 DEBUG Processed: _posts/spring-transaction.md
14:33:04.534 DEBUG Processed: layout/category.ejs
14:33:04.536 DEBUG Processed: layout/archive.ejs
14:33:04.538 DEBUG Processed: layout/index.ejs
14:33:04.540 DEBUG Processed: layout/layout.ejs
14:33:04.541 DEBUG Processed: layout/page.ejs
14:33:04.542 DEBUG Processed: layout/post.ejs
14:33:04.543 DEBUG Processed: layout/tag.ejs
14:33:04.553 DEBUG Processed: categories/index.md
14:33:04.554 DEBUG Processed: tags/index.md
14:33:04.555 DEBUG Processed: img/20160822/5.jpg
14:33:04.565 DEBUG Processed: source/css/fonts/FontAwesome.otf
14:33:04.567 DEBUG Processed: source/css/fonts/fontawesome-webfont.eot
14:33:04.570 DEBUG Processed: source/css/fonts/fontawesome-webfont.woff
14:33:04.571 DEBUG Processed: source/fancybox/helpers/fancybox_buttons.png
14:33:04.572 DEBUG Processed: source/fancybox/helpers/jquery.fancybox-buttons.css
14:33:04.573 DEBUG Processed: source/fancybox/helpers/jquery.fancybox-buttons.js
14:33:04.574 DEBUG Processed: source/fancybox/helpers/jquery.fancybox-media.js
14:33:04.575 DEBUG Processed: source/fancybox/helpers/jquery.fancybox-thumbs.css
14:33:04.577 DEBUG Processed: source/fancybox/helpers/jquery.fancybox-thumbs.js
14:33:04.583 DEBUG Processed: source/css/fonts/fontawesome-webfont.ttf
14:33:04.594 DEBUG Processed: layout/_partial/after-footer.ejs
14:33:04.594 DEBUG Processed: layout/_partial/archive-post.ejs
14:33:04.595 DEBUG Processed: layout/_partial/archive.ejs
14:33:04.596 DEBUG Processed: layout/_partial/article.ejs
14:33:04.600 DEBUG Processed: layout/_partial/footer.ejs
14:33:04.601 DEBUG Processed: layout/_partial/google-analytics.ejs
14:33:04.603 DEBUG Processed: layout/_partial/head.ejs
14:33:04.604 DEBUG Processed: layout/_partial/header.ejs
14:33:04.605 DEBUG Processed: layout/_partial/mobile-nav.ejs
14:33:04.606 DEBUG Processed: layout/_partial/sidebar.ejs
14:33:04.607 DEBUG Processed: layout/_widget/archive.ejs
14:33:04.608 DEBUG Processed: layout/_widget/category.ejs
14:33:04.611 DEBUG Processed: layout/_widget/tag.ejs
14:33:04.612 DEBUG Processed: layout/_widget/recent_posts.ejs
14:33:04.613 DEBUG Processed: layout/_widget/tagcloud.ejs
14:33:04.622 DEBUG Processed: source/css/fonts/fontawesome-webfont.svg
14:33:04.623 DEBUG Processed: source/css/images/banner.jpg
14:33:04.628 DEBUG Processed: layout/_partial/post/category.ejs
14:33:04.629 DEBUG Processed: layout/_partial/post/date.ejs
14:33:04.631 DEBUG Processed: layout/_partial/post/gallery.ejs
14:33:04.633 DEBUG Processed: layout/_partial/post/nav.ejs
14:33:04.635 DEBUG Processed: layout/_partial/post/tag.ejs
14:33:04.636 DEBUG Processed: layout/_partial/post/title.ejs
14:33:04.898 FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Template render error: (unknown path)
  SyntaxError: Unexpected token ILLEGAL
    at Object.exports.prettifyError (D:\project\git\blog\node_modules\hexo\node_modules\nunjucks\src\lib.js:34:15)
    at Obj.extend.render (D:\project\git\blog\node_modules\hexo\node_modules\nunjucks\src\environment.js:469:27)
    at Obj.extend.renderString (D:\project\git\blog\node_modules\hexo\node_modules\nunjucks\src\environment.js:327:21)
    at D:\project\git\blog\node_modules\hexo\lib\extend\tag.js:66:9
    at Promise._execute (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\debuggability.js:299:9)
    at Promise._resolveFromExecutor (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:481:18)
    at new Promise (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:77:14)
    at Tag.render (D:\project\git\blog\node_modules\hexo\lib\extend\tag.js:64:10)
    at Object.tagFilter [as onRenderEnd] (D:\project\git\blog\node_modules\hexo\lib\hexo\post.js:253:16)
    at D:\project\git\blog\node_modules\hexo\lib\hexo\render.js:65:19
    at tryCatcher (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:510:31)
    at Promise._settlePromise (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:567:18)    at Promise._settlePromise0 (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:612:10)
    at Promise._settlePromises (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:691:18)
    at Async._drainQueue (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\async.js:138:16)
    at Async._drainQueues (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\async.js:148:10)
    at Immediate.Async.drainQueues [as _onImmediate] (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\async.js:17:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)
14:33:04.925 DEBUG Database saved
14:33:04.926 FATAL (unknown path)
  SyntaxError: Unexpected token ILLEGAL
Template render error: (unknown path)
  SyntaxError: Unexpected token ILLEGAL
    at Object.exports.prettifyError (D:\project\git\blog\node_modules\hexo\node_modules\nunjucks\src\lib.js:34:15)
    at Obj.extend.render (D:\project\git\blog\node_modules\hexo\node_modules\nunjucks\src\environment.js:469:27)
    at Obj.extend.renderString (D:\project\git\blog\node_modules\hexo\node_modules\nunjucks\src\environment.js:327:21)
    at D:\project\git\blog\node_modules\hexo\lib\extend\tag.js:66:9
    at Promise._execute (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\debuggability.js:299:9)
    at Promise._resolveFromExecutor (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:481:18)
    at new Promise (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:77:14)
    at Tag.render (D:\project\git\blog\node_modules\hexo\lib\extend\tag.js:64:10)
    at Object.tagFilter [as onRenderEnd] (D:\project\git\blog\node_modules\hexo\lib\hexo\post.js:253:16)
    at D:\project\git\blog\node_modules\hexo\lib\hexo\render.js:65:19
    at tryCatcher (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:510:31)
    at Promise._settlePromise (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:567:18)    at Promise._settlePromise0 (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:612:10)
    at Promise._settlePromises (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\promise.js:691:18)
    at Async._drainQueue (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\async.js:138:16)
    at Async._drainQueues (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\async.js:148:10)
    at Immediate.Async.drainQueues [as _onImmediate] (D:\project\git\blog\node_modules\hexo\node_modules\bluebird\js\release\async.js:17:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)
pirtleshell commented 8 years ago

So I found some things and some of them may be bugs with hexo's default markdown renderer.

When I said I could render it, I had just thrown it into my working file that uses hexo-renderer-markdown-it in place of hexo-renderer-markdown. I retried with a vanilla install of hexo and got the same errors as you right off the bat.

On some inspection, I found a possibly malformed character that occurs twice in your document that my editor couldn't recognize. It has the character code 8232 and occurs at (line, col) = (16, 53) and (92, 83). According to my text editor, the first one is the 429th character in my copy of your post:

var fs = require('fs')
var postBuffer = fs.readFileSync('spring-transaction.md')
var post = '' + postBuffer

post.charCodeAt(428)
// 8232
String.fromCharCode(8232)
// '


The other problem is that you need a space separating your title from the title: in your front matter.

title: 【转】深入理解 Spring 事务原理

not

title:【转】深入理解 Spring 事务原理

which is a ridiculous difference that matters...

Changing both of these things allowed me to render the post.

For the improvement of hexo-renderer-markdown

zhangtianle commented 8 years ago

Thank you for your patience to answer, I have successfully solved the problem :)