报错信息

GitHub Actions 流程中 hexo g 出现错误,具体错误在“Vue笔记”中那篇文章中,有个地方用到了大括号嵌套的情况。

  1. ===== Context Dump Ends =====
  2. at formatNunjucksError (/home/runner/work/website/website/node_modules/hexo/lib/extend/tag.js:102:13)
  3. at Promise.fromCallback.catch.err (/home/runner/work/website/website/node_modules/hexo/lib/extend/tag.js:124:34)
  4. at tryCatcher (/home/runner/work/website/website/node_modules/bluebird/js/release/util.js:16:23)
  5. at Promise._settlePromiseFromHandler (/home/runner/work/website/website/node_modules/bluebird/js/release/promise.js:547:31)
  6. at Promise._settlePromise (/home/runner/work/website/website/node_modules/bluebird/js/release/promise.js:604:18)
  7. at Promise._settlePromise0 (/home/runner/work/website/website/node_modules/bluebird/js/release/promise.js:649:10)
  8. at Promise._settlePromises (/home/runner/work/website/website/node_modules/bluebird/js/release/promise.js:725:18)
  9. at _drainQueueStep (/home/runner/work/website/website/node_modules/bluebird/js/release/async.js:93:12)
  10. at _drainQueue (/home/runner/work/website/website/node_modules/bluebird/js/release/async.js:86:9)
  11. at Async._drainQueues (/home/runner/work/website/website/node_modules/bluebird/js/release/async.js:102:5)
  12. at Immediate.Async.drainQueues [as _onImmediate] (/home/runner/work/website/website/node_modules/bluebird/js/release/async.js:15:14)
  13. at runCallback (timers.js:705:18)
  14. at tryOnImmediate (timers.js:676:5)
  15. at processImmediate (timers.js:658:5)
  16. Error: Process completed with exit code 2.

问题分析与解决

上述代码中第二行其实已经说的很明确 at formatNunjucksError
但是hexo中,渲染过程中用到的是Nunjucks,在Nunjucks中双大括号被视为语法,所以报错。

小记

https://www.wztlink1013.com/blog/pxpix4/

其实之前遇到过类似的问题……写的博客还是要经常回顾……