bennyxguo / hexo-theme-obsidian

🎨 A dark Hexo theme, it's responsive, simple but elegant.
https://obsidian.tridiamond.tech/
MIT License
781 stars 108 forks source link

在运行之后报错 #140

Closed sunnnnnner closed 3 years ago

sunnnnnner commented 3 years ago

在 hexo server 运行之后 在 浏览器访问 ,然后就会报如下错误

INFO Validating config INFO Start processing INFO Hexo is running at http://localhost:4000 . Press Ctrl+C to stop. ERROR { err: TypeError: /tgz/nodejs/hexo/themes/obsidian/layout/layout.ejs:33 31| 32| <%- link_to("https://github.com/TriDiamond/hexo-theme-obsidian/blob/master/CHANGELOG.md", 'v'+theme.version, {external: true})%>

33| <% if (theme.beian.enable == true) { %> 34|
35| <%= theme.beian.beianloc %> 36|

Cannot read property 'enable' of undefined at eval (/tgz/nodejs/hexo/themes/obsidian/layout/layout.ejs:37:24) at layout (/tgz/nodejs/hexo/node_modules/ejs/lib/ejs.js:682:17) at _View._compiled (/tgz/nodejs/hexo/node_modules/hexo/lib/theme/view.js:136:50) at _View.render (/tgz/nodejs/hexo/node_modules/hexo/lib/theme/view.js:39:17) at /tgz/nodejs/hexo/node_modules/hexo/lib/theme/view.js:51:25 at tryCatcher (/tgz/nodejs/hexo/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/tgz/nodejs/hexo/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/tgz/nodejs/hexo/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/tgz/nodejs/hexo/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/tgz/nodejs/hexo/node_modules/bluebird/js/release/promise.js:729:18) at _drainQueueStep (/tgz/nodejs/hexo/node_modules/bluebird/js/release/async.js:93:12) at _drainQueue (/tgz/nodejs/hexo/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/tgz/nodejs/hexo/node_modules/bluebird/js/release/async.js:102:5) at Immediate.Async.drainQueues [as _onImmediate] (/tgz/nodejs/hexo/node_modules/bluebird/js/release/async.js:15:14) at processImmediate (node:internal/timers:463:21) { path: '/tgz/nodejs/hexo/themes/obsidian/layout/layout.ejs' } } Render HTML failed: index.html Unhandled rejection TypeError: /tgz/nodejs/hexo/themes/obsidian/layout/layout.ejs:33 31| 32| <%- link_to("https://github.com/TriDiamond/hexo-theme-obsidian/blob/master/CHANGELOG.md", 'v'+theme.version, {external: true})%>

33| <% if (theme.beian.enable == true) { %> 34|
35| <%= theme.beian.beianloc %> 36|

Cannot read property 'enable' of undefined at eval (/tgz/nodejs/hexo/themes/obsidian/layout/layout.ejs:37:24) at layout (/tgz/nodejs/hexo/node_modules/ejs/lib/ejs.js:682:17) at _View._compiled (/tgz/nodejs/hexo/node_modules/hexo/lib/theme/view.js:136:50) at _View.render (/tgz/nodejs/hexo/node_modules/hexo/lib/theme/view.js:39:17) at /tgz/nodejs/hexo/node_modules/hexo/lib/theme/view.js:51:25 at tryCatcher (/tgz/nodejs/hexo/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/tgz/nodejs/hexo/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/tgz/nodejs/hexo/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/tgz/nodejs/hexo/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/tgz/nodejs/hexo/node_modules/bluebird/js/release/promise.js:729:18) at _drainQueueStep (/tgz/nodejs/hexo/node_modules/bluebird/js/release/async.js:93:12) at _drainQueue (/tgz/nodejs/hexo/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/tgz/nodejs/hexo/node_modules/bluebird/js/release/async.js:102:5) at Immediate.Async.drainQueues [as _onImmediate] (/tgz/nodejs/hexo/node_modules/bluebird/js/release/async.js:15:14) at processImmediate (node:internal/timers:463:21)

^CINFO Have a nice day

kcn3388 commented 3 years ago

检查配置文件有没有如下字段 image

kcn3388 commented 3 years ago

已定位原因,config模板文件写错了,详细配置以上图为准,详细commit:https://github.com/kcn3388/hexo-theme-obsidian/commit/c7818fef7304092eee21dfeb4d135cf4013e1277 Already fix, config file error, view details here: https://github.com/kcn3388/hexo-theme-obsidian/commit/c7818fef7304092eee21dfeb4d135cf4013e1277

sunnnnnner commented 3 years ago

已定位原因,config模板文件写错了,详细配置以上图为准,详细commit:kcn3388@c7818fe Already fix, config file error, view details here: kcn3388@c7818fe

你所说的confi 模板文件是那个目录的文件

sunnnnnner commented 3 years ago

我查看 master分支,已经是最新的commit了,最新的更改是 28天前

sunnnnnner commented 3 years ago

在把_config_template_cn.yml 文件完全复制过去可以了

kcn3388 commented 3 years ago

在把_config_template_cn.yml 文件完全复制过去可以了

以我回复的图为准 提交的commit在我的fork里面,作者最近忙没时间pass pull request

bennyxguo commented 3 years ago

在把_config_template_cn.yml 文件完全复制过去可以了

以我回复的图为准 提交的commit在我的fork里面,作者最近忙没时间pass pull request

PR 已经合并了~

BaHui commented 3 years ago

您好, 我使用了最新的master代码, 依然是报错

kcn3388 commented 3 years ago

您好, 我使用了最新的master代码, 依然是报错

请post报错 可能的解决方法:在template进行自定义,然后修改template的名字为_config.yml

BaHui commented 3 years ago

Unhandled rejection TypeError: /Users/qiaobahui/Coding/blog/themes/obsidian/layout/layout.ejs:51 49| 50| <%- partial('_partial/mathjax', null, {cache: true}) %>

51| <%- partial('_partial/scripts', null, {cache: true}) %> 52| <% if (theme.aplayer.enable == true) { %> 53| 54|

/Users/qiaobahui/Coding/blog/themes/obsidian/layout/_partial/scripts.ejs:1

1| <% if (theme.gitalk.enable == true) { %> <%- 2| css(['//cdn.bootcss.com/gitalk/1.5.0/gitalk.min.css'])%> <%- 3| js(['//cdn.bootcss.com/gitalk/1.5.0/gitalk.min.js'])%> <% } %> <%- 4| js(['//cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js', 'js/plugin.js', 'js/obsidian.js',

Cannot read property 'enable' of undefined at eval (/Users/qiaobahui/Coding/blog/themes/obsidian/layout/_partial/scripts.ejs:10:25) at scripts (/Users/qiaobahui/Coding/blog/node_modules/ejs/lib/ejs.js:682:17) at _View._compiledSync (/Users/qiaobahui/Coding/blog/node_modules/hexo/lib/theme/view.js:132:24) at _View.renderSync (/Users/qiaobahui/Coding/blog/node_modules/hexo/lib/theme/view.js:59:25) at /Users/qiaobahui/Coding/blog/node_modules/hexo/lib/plugins/helper/partial.js:31:52 at Cache.apply (/Users/qiaobahui/Coding/blog/node_modules/hexo-util/lib/cache.js:27:46) at Object.fragmentCache (/Users/qiaobahui/Coding/blog/node_modules/hexo/lib/plugins/helper/fragment_cache.js:11:34) at Object.partial (/Users/qiaobahui/Coding/blog/node_modules/hexo/lib/plugins/helper/partial.js:31:17) at eval (/Users/qiaobahui/Coding/blog/themes/obsidian/layout/layout.ejs:69:17) at layout (/Users/qiaobahui/Coding/blog/node_modules/ejs/lib/ejs.js:682:17) at _View._compiled (/Users/qiaobahui/Coding/blog/node_modules/hexo/lib/theme/view.js:136:50) at _View.render (/Users/qiaobahui/Coding/blog/node_modules/hexo/lib/theme/view.js:39:17) at /Users/qiaobahui/Coding/blog/node_modules/hexo/lib/theme/view.js:51:25 at tryCatcher (/Users/qiaobahui/Coding/blog/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/Users/qiaobahui/Coding/blog/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/Users/qiaobahui/Coding/blog/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/Users/qiaobahui/Coding/blog/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/Users/qiaobahui/Coding/blog/node_modules/bluebird/js/release/promise.js:729:18) at _drainQueueStep (/Users/qiaobahui/Coding/blog/node_modules/bluebird/js/release/async.js:93:12) at _drainQueue (/Users/qiaobahui/Coding/blog/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/Users/qiaobahui/Coding/blog/node_modules/bluebird/js/release/async.js:102:5) at Immediate.Async.drainQueues [as _onImmediate] (/Users/qiaobahui/Coding/blog/node_modules/bluebird/js/release/async.js:15:14)

BaHui commented 3 years ago

您好, 我使用的是master上面的config代码, 重命名为_config.yml. clean之后重新部署还是报了这个错, 请问是什么原因?

kcn3388 commented 3 years ago

您好, 我使用的是master上面的config代码, 重命名为_config.yml. clean之后重新部署还是报了这个错, 请问是什么原因?

请post一下_config.yml的详细内容

kcn3388 commented 3 years ago

您好, 我使用的是master上面的config代码, 重命名为_config.yml. clean之后重新部署还是报了这个错, 请问是什么原因?

已定位原因,稍后会有pr

kcn3388 commented 3 years ago

您好, 我使用的是master上面的config代码, 重命名为_config.yml. clean之后重新部署还是报了这个错, 请问是什么原因?

Pull request already pushed.