使用Next主题遇到的一个坑

昨天晚上睡前,打算把博客的主题,替换成Next,Next的Github地址

对着Next的使用文档就开始进行配置,到了最终执行Hexo g来生成博客文章的时候,报错了!!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Unhandled rejection Error: ENOENT: no such file or directory, open 'C:\github\blog\themes\next\layout\_scripts\schemes\.swig'
at Error (native)
at Object.fs.openSync (fs.js:584:18)
at Object.fs.readFileSync (fs.js:431:33)
at Object.ret.load (C:\github\blog\node_modules\swig\lib\loaders\filesystem.js:55:15)
at compileFile (C:\github\blog\node_modules\swig\lib\swig.js:695:31)
at Object.eval [as tpl] (eval at <anonymous> (C:\github\blog\node_modules\swig\lib\swig.js:498:13), <anonymous>:293:18)
at compiled [as _compiledSync] (C:\github\blog\node_modules\swig\lib\swig.js:619:18)
at tryCatcher (C:\github\blog\node_modules\bluebird\js\release\util.js:16:23)
at null._compiled (C:\github\blog\node_modules\bluebird\js\release\method.js:15:34)
at View.render (C:\github\blog\node_modules\hexo\lib\theme\view.js:29:15)
at C:\github\blog\node_modules\hexo\lib\hexo\index.js:387:25
at tryCatcher (C:\github\blog\node_modules\bluebird\js\release\util.js:16:23)
at C:\github\blog\node_modules\bluebird\js\release\method.js:15:34
at RouteStream._read (C:\github\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:383:13)
at process._tickCallback (node.js:407:11)

no such file or directory??

好吧,谷歌大法出动,一番搜索下来,找到了这个帖子

里边说到:

有碰到 YAMLException: bad indentation of a mapping entry 这种提示的,最好找个 YAML Lint 验证下 _config.yml 是否有问题。

往回翻看报错信息,还真有这个报错,那有可能是配置格式出错了。

1
2
YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 144, column 1:
# Table Of Contents in the Sidebar

回到配置文件,在144行的上边,发现是少了一个空格。。

这个是错误的版本:

1
avatar:/images/avatar.png

这个是正确的版本:

1
avatar: /images/avatar.png

问题解决,PS:Next主题的效果很合胃口啊~哈哈。