λ hexo qiniu i ERROR Plugin load failed: hexo-qiniu-sync SyntaxError: Unexpected token a at Object.parse (native) at Object.<anonymous> (E:\hexoBlog\hexo\node_modules\hexo-qiniu-sync\config.js:10:17) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (E:\hexoBlog\hexo\node_modules\hexo\lib\hexo\index.js:213:21) at E:\hexoBlog\hexo\node_modules\hexo-qiniu-sync\index.js:9:14 at E:\hexoBlog\hexo\node_modules\hexo\lib\hexo\index.js:229:12 at tryCatcher (E:\hexoBlog\hexo\node_modules\hexo-fs\node_modules\bluebird\js\release\util.js:16:23) at Promise._settlePromiseFromHandler (E:\hexoBlog\hexo\node_modules\hexo-fs\node_modules\bluebird\js\release\promise.js:497:31) at Promise._settlePromise (E:\hexoBlog\hexo\node_modules\hexo-fs\node_modules\bluebird\js\release\promise.js:555:18) at Promise._settlePromise0 (E:\hexoBlog\hexo\node_modules\hexo-fs\node_modules\bluebird\js\release\promise.js:600:10) at Promise._settlePromises (E:\hexoBlog\hexo\node_modules\hexo-fs\node_modules\bluebird\js\release\promise.js:683:18) at Promise._fulfill (E:\hexoBlog\hexo\node_modules\hexo-fs\node_modules\bluebird\js\release\promise.js:624:18) at Promise._resolveCallback (E:\hexoBlog\hexo\node_modules\hexo-fs\node_modules\bluebird\js\release\promise.js:424:57) at Promise._settlePromiseFromHandler (E:\hexoBlog\hexo\node_modules\hexo-fs\node_modules\bluebird\js\release\promise.js:510:17) at Promise._settlePromise (E:\hexoBlog\hexo\node_modules\hexo-fs\node_modules\bluebird\js\release\promise.js:555:18) at Promise._settlePromise0 (E:\hexoBlog\hexo\node_modules\hexo-fs\node_modules\bluebird\js\release\promise.js:600:10) at Promise._settlePromises (E:\hexoBlog\hexo\node_modules\hexo-fs\node_modules\bluebird\js\release\promise.js:683:18) at Promise._fulfill (E:\hexoBlog\hexo\node_modules\hexo-fs\node_modules\bluebird\js\release\promise.js:624:18) at E:\hexoBlog\hexo\node_modules\hexo-fs\node_modules\bluebird\js\release\nodeback.js:42:21 at E:\hexoBlog\hexo\node_modules\graceful-fs\graceful-fs.js:78:16 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
继续前天的工作,想到了先把秘钥配置写到 _config.xml 中测试了下是 OK 的,那么就是单独读取秘钥文件的时候不成功,可能的原因:
秘钥路径不正确 改为 ./sec/qn.json
qn.json 文件格式不正确,改为了严格的 json 格式 OK 了
插件的配置 OK 了,看下插件的使用了,官网的使用方式:
{% qnimg qiniu.jpg title:qnimg alt:qnimg %}
文件保存到根目录下的 static/img 目录下,同步成功了
页面上不显示:
我开启了白名单功能,只有白名单中的域名可以加载
设置了自定义域名功能,需要设置 urlPrefix属性设置为自定义的域名
每次都贴一次很麻烦啊,直接定义 sublime text snippet: qnimg:
<snippet> <content ><![CDATA[ {% qnimg ${1:imgName} title:${2:imgTitile} alt:${2:imgTitle} %} ]]></content > <!-- Optional: Set a tabTrigger to define how to trigger the snippet --> <tabTrigger>qnimg</tabTrigger> <!-- Optional: Set a scope to limit where the snippet will trigger --> <scope>text.html.markdown</scope> </snippet>
根据作者的介绍使用 offline:true配置可以开启 本地调用功能的,并且更新到 V 1.4.5 版本解决了软连的问题
2016-09-27
更新的时候 hexo v3.2.2 更新后 没有了 hexo server 选项了,这也没法开启 offline:true 验证了,hexo 官方确认是个 windows 下的 bug
2016-12-21
有时间了,再折腾下上次遗留的问题: hexo-qiniu-sync插件配置好后 hexo server 无法启动了
上次冲洗 hexo init 个 blog 是有 hexo server 命令的,所以肯定了这个是插件引起的问题
在配置_config.yml 中去掉了关于 hexo-qiniu-sync 的配置
λ hexo server ERROR Plugin load failed: hexo-qiniu-sync TypeError: Cannot read property 'secret_file' of undefined at Object.<anonymous> (F:\nodeDev\hexo\node_modules\hexo-qiniu-sync\config.js:8:21) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (F:\nodeDev\hexo\node_modules\hexo\lib\hexo\index.js:213:21) at F:\nodeDev\hexo\node_modules\hexo-qiniu-sync\index.js:9:14 at F:\nodeDev\hexo\node_modules\hexo\lib\hexo\index.js:229:12 at tryCatcher (F:\nodeDev\hexo\node_modules\bluebird\js\release\util.js:16:23) at Promise._settlePromiseFromHandler (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:510:31) at Promise._settlePromise (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:567:18) at Promise._settlePromise0 (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:612:10) at Promise._settlePromises (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:691:18) at Promise._fulfill (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:636:18) at Promise._resolveCallback (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:431:57) at Promise._settlePromiseFromHandler (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:522:17) at Promise._settlePromise (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:567:18) at Promise._settlePromise0 (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:612:10) at Promise._settlePromises (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:691:18) at Promise._fulfill (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:636:18) at F:\nodeDev\hexo\node_modules\bluebird\js\release\nodeback.js:42:21 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) [Line 91, Column 2] unknown block tag: qnimg at Object.exports.prettifyError (F:\nodeDev\hexo\node_modules\nunjucks\src\lib.js:34:15) at Obj.extend.render (F:\nodeDev\hexo\node_modules\nunjucks\src\environment.js:469:27) at Obj.extend.renderString (F:\nodeDev\hexo\node_modules\nunjucks\src\environment.js:327:21) at F:\nodeDev\hexo\node_modules\hexo\lib\extend\tag.js:66:9 at Promise._execute (F:\nodeDev\hexo\node_modules\bluebird\js\release\debuggability.js:299:9) at Promise._resolveFromExecutor (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:481:18) at new Promise (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:77:14) at Tag.render (F:\nodeDev\hexo\node_modules\hexo\lib\extend\tag.js:64:10) at Object.tagFilter [as onRenderEnd] (F:\nodeDev\hexo\node_modules\hexo\lib\hexo\post.js:253:16) at F:\nodeDev\hexo\node_modules\hexo\lib\hexo\render.js:65:19 at tryCatcher (F:\nodeDev\hexo\node_modules\bluebird\js\release\util.js:16:23) at Promise._settlePromiseFromHandler (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:510:31) at Promise._settlePromise (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:567:18) at Promise._settlePromise0 (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:612:10) at Promise._settlePromises (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:691:18) at Async._drainQueue (F:\nodeDev\hexo\node_modules\bluebird\js\release\async.js:138:16) at Async._drainQueues (F:\nodeDev\hexo\node_modules\bluebird\js\release\async.js:148:10) at Immediate.Async.drainQueues [as _onImmediate] (F:\nodeDev\hexo\node_modules\bluebird\js\release\async.js:17:14) at processImmediate [as _immediateCallback] (timers.js:383:17) FATAL (unknown path) [Line 91, Column 2] unknown block tag: qnimg Template render error: (unknown path) [Line 91, Column 2] unknown block tag: qnimg at Object.exports.prettifyError (F:\nodeDev\hexo\node_modules\nunjucks\src\lib.js:34:15) at Obj.extend.render (F:\nodeDev\hexo\node_modules\nunjucks\src\environment.js:469:27) at Obj.extend.renderString (F:\nodeDev\hexo\node_modules\nunjucks\src\environment.js:327:21) at F:\nodeDev\hexo\node_modules\hexo\lib\extend\tag.js:66:9 at Promise._execute (F:\nodeDev\hexo\node_modules\bluebird\js\release\debuggability.js:299:9) at Promise._resolveFromExecutor (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:481:18) at new Promise (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:77:14) at Tag.render (F:\nodeDev\hexo\node_modules\hexo\lib\extend\tag.js:64:10) at Object.tagFilter [as onRenderEnd] (F:\nodeDev\hexo\node_modules\hexo\lib\hexo\post.js:253:16) at F:\nodeDev\hexo\node_modules\hexo\lib\hexo\render.js:65:19 at tryCatcher (F:\nodeDev\hexo\node_modules\bluebird\js\release\util.js:16:23) at Promise._settlePromiseFromHandler (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:510:31) at Promise._settlePromise (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:567:18) at Promise._settlePromise0 (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:612:10) at Promise._settlePromises (F:\nodeDev\hexo\node_modules\bluebird\js\release\promise.js:691:18) at Async._drainQueue (F:\nodeDev\hexo\node_modules\bluebird\js\release\async.js:138:16) at Async._drainQueues (F:\nodeDev\hexo\node_modules\bluebird\js\release\async.js:148:10) at Immediate.Async.drainQueues [as _onImmediate] (F:\nodeDev\hexo\node_modules\bluebird\js\release\async.js:17:14) at processImmediate [as _immediateCallback] (timers.js:383:17)