Hexo-报错汇总

博客从搭建到优化,基本上一路绿灯,今天终于迎来了"first err",对着代码愣是懵逼了半天没找出来到底哪里错了。


模板渲染错误 (Template render error)

错误信息如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
INFO  Start processing
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Template render error: Error: template not found: ../_custom/sidebar.swig
at Object._prettifyError (E:\Node_JS_Hexo\node_modules\nunjucks\src\lib.js:35:11)
at E:\Node_JS_Hexo\node_modules\nunjucks\src\environment.js:547:19
at eval (eval at _compile (E:\Node_JS_Hexo\node_modules\nunjucks\src\environment.js:617:18), <anonymous>:13:11)
at createTemplate (E:\Node_JS_Hexo\node_modules\nunjucks\src\environment.js:279:11)
at next (E:\Node_JS_Hexo\node_modules\nunjucks\src\lib.js:283:7)
at handle (E:\Node_JS_Hexo\node_modules\nunjucks\src\environment.js:313:11)
at E:\Node_JS_Hexo\node_modules\nunjucks\src\environment.js:323:9
at next (E:\Node_JS_Hexo\node_modules\nunjucks\src\lib.js:281:7)
at Object.asyncIter (E:\Node_JS_Hexo\node_modules\nunjucks\src\lib.js:287:3)
at Environment.getTemplate (E:\Node_JS_Hexo\node_modules\nunjucks\src\environment.js:305:9)
at eval (eval at _compile (E:\Node_JS_Hexo\node_modules\nunjucks\src\environment.js:617:18), <anonymous>:12:5)
at fn (E:\Node_JS_Hexo\node_modules\a-sync-waterfall\index.js:26:24)
at E:\Node_JS_Hexo\node_modules\a-sync-waterfall\index.js:66:22
at executeSync (E:\Node_JS_Hexo\node_modules\a-sync-waterfall\index.js:8:15)
at E:\Node_JS_Hexo\node_modules\a-sync-waterfall\index.js:65:11
at waterfall (E:\Node_JS_Hexo\node_modules\a-sync-waterfall\index.js:71:38)
at Environment.waterfall (E:\Node_JS_Hexo\node_modules\nunjucks\src\environment.js:368:12)
at Template.root [as rootRenderFunc] (eval at _compile (E:\Node_JS_Hexo\node_modules\nunjucks\src\environment.js:617:18), <anonymous>:27:5)
at Template.render (E:\Node_JS_Hexo\node_modules\nunjucks\src\environment.js:540:10)
at Environment.renderString (E:\Node_JS_Hexo\node_modules\nunjucks\src\environment.js:364:17)
at Promise (E:\Node_JS_Hexo\node_modules\hexo\lib\extend\tag.js:66:9)
at Promise._execute (E:\Node_JS_Hexo\node_modules\bluebird\js\release\debuggability.js:303:9)
at Promise._resolveFromExecutor (E:\Node_JS_Hexo\node_modules\bluebird\js\release\promise.js:483:18)
at new Promise (E:\Node_JS_Hexo\node_modules\bluebird\js\release\promise.js:79:10)
at Tag.render (E:\Node_JS_Hexo\node_modules\hexo\lib\extend\tag.js:64:10)
at Object.tagFilter [as onRenderEnd] (E:\Node_JS_Hexo\node_modules\hexo\lib\hexo\post.js:230:16)
at Promise.then.then.result (E:\Node_JS_Hexo\node_modules\hexo\lib\hexo\render.js:65:19)
at tryCatcher (E:\Node_JS_Hexo\node_modules\bluebird\js\release\util.js:16:23)

确定代码没有错误,网上找了很多资料,最后发现了异常的原因,是因为我在一篇文章中贴入的代码存在有特殊字符,解析时讲表达式中的内容按函数处理了,所以导致了异常。解决的办法就是将特殊的字符进行转义或者直接删掉要贴入到Markdown文件的代码。

关于转义字符可以参考w3school

git:无法找到命令

  几天没更新博客,今天更新的时候突然冒出了个:hexo clean command not found,在尝试了其他的两个命令hexo ghexo d的时候也显示无法找到命令,于是输入node -vnpm -v发现都没问题,百度了一下说是环境变量的问题,顿时想起几天前在自己的机子上装了Oracle数据库,由于电脑原来用的是中文用户名,安装Oracle的时候报了个C++错误,大概就是安装路径不能够有中文,所以就把账户改成了英文的,包括C盘下的user目录下的用户文件夹也改了,于是尝试将原来的环境变量上的中文用户名改了,但是发现并木有用,于是又在PATH上添加了一条新的路径:C:\Users\LQZ\AppData\Roaming\npm\node_modules\hexo\bin,问题就解决了,原来的PATH路径是:C:\Users\XXX\AppData\Roaming\npm,其中XXX就是当前电脑的用户名。


如果您觉得我的文章对您有帮助,请随意赞赏,您的支持将鼓励我继续创作!
0%