iblh / hexo-theme-material

Material Design theme for hexo.
https://iblh.github.io/material-demo/
GNU General Public License v3.0
4.03k stars 564 forks source link

hexo generate 报错 #85

Closed beamaster closed 7 years ago

beamaster commented 7 years ago
steamdeMacBook-Pro :: ~/blog % hexo clean
INFO  Deleted database.
INFO  Deleted public folder.
steamdeMacBook-Pro :: ~/blog % hexo g
INFO  Start processing
INFO  Files loaded in 631 ms

下面是错误

Unhandled rejection TypeError: /Users/steam/blog/themes/material/layout/post.ejs:60
    58|                 <% if(theme.scheme == "Paradox"){ %>
    59|                     <!-- Paradox Post Info -->
 >> 60|                     <%- partial('_partial/Paradox-post-info') %>
    61|                 <% } %>
    62|
    63|                 <!-- Post Content -->

/Users/steam/blog/themes/material/layout/_partial/Paradox-post-info.ejs:45
    43|     <ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="article-functions-viewtags-button">
    44|         <li class="mdl-menu__item">
 >> 45|         <%- list_tags(page.tags, {
    46|             show_count: false,
    47|             class: 'post_tag',
    48|             style: 'none',

tags.sort is not a function
    at Object.listTagsHelper (/Users/steam/blog/node_modules/hexo/lib/plugins/helper/list_tags.js:23:15)
    at Object.wrapper [as list_tags] (/Users/steam/blog/node_modules/lodash/lodash.js:4968:19)
    at eval (eval at <anonymous> (/Users/steam/blog/node_modules/ejs/lib/ejs.js:242:14), <anonymous>:32:572)
    at eval (eval at <anonymous> (/Users/steam/blog/node_modules/ejs/lib/ejs.js:242:14), <anonymous>:37:135)
    at /Users/steam/blog/node_modules/ejs/lib/ejs.js:255:15
    at _compiledSync (/Users/steam/blog/node_modules/hexo/lib/theme/view.js:122:20)
    at View.renderSync (/Users/steam/blog/node_modules/hexo/lib/theme/view.js:50:21)
    at Object.partial (/Users/steam/blog/node_modules/hexo/lib/plugins/helper/partial.js:42:17)
    at Object.wrapper (/Users/steam/blog/node_modules/lodash/lodash.js:4968:19)
    at eval (eval at <anonymous> (/Users/steam/blog/node_modules/ejs/lib/ejs.js:242:14), <anonymous>:30:2376)
    at eval (eval at <anonymous> (/Users/steam/blog/node_modules/ejs/lib/ejs.js:242:14), <anonymous>:30:3271)
    at /Users/steam/blog/node_modules/ejs/lib/ejs.js:255:15
    at _compiled (/Users/steam/blog/node_modules/hexo/lib/theme/view.js:127:30)
    at View.render (/Users/steam/blog/node_modules/hexo/lib/theme/view.js:29:15)
    at /Users/steam/blog/node_modules/hexo/lib/hexo/index.js:387:25
    at tryCatcher (/Users/steam/blog/node_modules/bluebird/js/release/util.js:16:23)
    at /Users/steam/blog/node_modules/bluebird/js/release/method.js:15:34
    at RouteStream._read (/Users/steam/blog/node_modules/hexo/lib/hexo/router.js:134:3)
    at RouteStream.Readable.read (_stream_readable.js:336:10)
    at resume_ (_stream_readable.js:726:12)
    at _combinedTickCallback (node.js:377:13)
    at process._tickCallback (node.js:401:11)
iblh commented 7 years ago

是否有对这个主题做什么额外的更改?或者之前使用其他主题时是否有安装什么插件?

cubesky commented 7 years ago

刚刚我这边有个人遇到了这个,他似乎是把tags部分写成了

tags:
  -标签

而不是

tags:
  - 标签

少了一个空格

beamaster commented 7 years ago

@viosey 我把原来的material主题删了,重新gitclone 然后配置了,虽然可以启动打开,但是还是报错。。。 插件什么的都很正常,(切换过其他主题,hexo generate 的时候也没报错)

[] ~/blog cd themes
[] ~/blog/themes rm -rf hexo-theme-material
[] ~/blog/themes ls
apollo     coney      huno       landscape  maupassant next
concise    fexo       kieran     material   minos      yilia
[] ~/blog/themes cd ..
[] ~/blog git clone https://github.com/viosey/hexo-theme-material.git themes/hexo-material
Cloning into 'themes/hexo-material'...
remote: Counting objects: 1357, done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 1357 (delta 31), reused 0 (delta 0), pack-reused 1304
Receiving objects: 100% (1357/1357), 4.59 MiB | 3.00 KiB/s, done.
Resolving deltas: 100% (826/826), done.
Checking connectivity... done.
[] ~/blog cd themes/hexo-material
[] ~/blog/themes/hexo-material <master> git pull
Already up-to-date.
[] ~/blog/themes/hexo-material <master> cd ..
[] ~/blog/themes cd ..
[] ~/blog hexo clean
INFO  Deleted database.
INFO  Deleted public folder.
[] ~/blog hexo g
INFO  Start processing
INFO  Files loaded in 642 ms
Unhandled rejection TypeError: /Users/steam/blog/themes/hexo-material/layout/post.ejs:60
    58|                 <% if(theme.scheme == "Paradox"){ %>
    59|                     <!-- Paradox Post Info -->
 >> 60|                     <%- partial('_partial/Paradox-post-info') %>
    61|                 <% } %>
    62|
    63|                 <!-- Post Content -->

/Users/steam/blog/themes/hexo-material/layout/_partial/Paradox-post-info.ejs:46
beamaster commented 7 years ago

问题排查出来了, 我在终端输入hexo new page 'board'之后 ,我的source根目录下多出了一个board 的目录,里面有一个index.md文件,就是这个多出来的board文件夹报错了,删掉之后,重新hexo generate 就没有错误提示了。

beamaster commented 7 years ago

不过令我疑惑的是,我使用其他主题的时候,这个board文件夹同样存在,也没提示错误,怎么回事呢?

iblh commented 7 years ago

感觉这个原因应该不是主要原因

neoFelhz commented 7 years ago

一定不是这个原因,默认 hexo new page title 就是会生成 title 文件夹的。

login926 commented 7 years ago

borad 文件夹中 index.md 文件中的 tags 参数是否设置正确?

beamaster commented 7 years ago

诡异的是,我现在 hexo new page 'xxx' 又恢复正常了,,,不知道什么地方闹鬼。反正这个问题我30号晚上到31号凌晨2点多都没弄好。。。还好赶着新年前解决了。。。` 也许是 index.md文件中的tags出了问题

现在一切ok看看我的blog-> https://beamaster.github.io/

各位新年快乐,2017,顺顺利利,健健康康的

beamaster commented 7 years ago

刚刚又把问题重现了一次,正如@login926 所说,问题出在了index.md文件的tags标签这里。下次有类似问题就有经验了。。。晚上得把这个bug整理出来。。。goodbye 2016,hello 2017

script74 commented 7 years ago

站点名称不能用汉字么?一改成汉字就乱码: title: 五折叔叔的水稻田 subtitle: 这家伙很懒,田里啥都没有。。。 description: 你可以无限接近地狱,但千万别进去。 author: Mr.Curiosity language: zh-CN timezone: UTC

neoFelhz commented 7 years ago

@script74 请使用 UTF8 编码。

iblh commented 7 years ago

@script74 Windows 不建议使用系统文本编辑器。