配置导致 Hexo 在 Gitlab 生成失败 “Error: EISDIR: illegal operation on a directory”

hexo 错误 Error: EISDIR: illegal operation on a directory

报错信息:Error: EISDIR: illegal operation on a directory

INFO  Files loaded in 2.89 s
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Error: EISDIR: illegal operation on a directory, open '/Users/yijile/Documents/git/yijile/public/log/346.html'
INFO  Generated: log/431.html/comment-page-2
INFO  Generated: log/365.html/comment-page-1
INFO  Generated: log/346.html/comment-page-1

Front-matter 配置错误导致 Gitlab 生成失败(Hexo g)

突然在 Gitlab ci/cd 无法执行生成完成构建、部署。通过hexo的报错逐一排除没有结果,后来看官方文档发现文档似乎太泛了难以定位问题,搜索一下也发下这个报错的情况很多,但是大家遇到的具体问题都不一样。

几经周折,发现因为使用了 hexo-generator-alias 插件,在 Front-matter 配置了相关重定向参数,可能是因为重定向插件逻辑问题导致无法在 Gitlab 构建和部署。

开始以为是 log/346.htmllog/346.html/comment-page-1 都包括了 log/346.html 所以导致了异常。在使用 hexo-generator-alias 插件配置重定向时避免这种情况就不会出现类似问题了,然后试了一下在 _config.yml 出现类似冲突耶会出现相关问题。

最后确认,是不能使用以下两种格式:

  • log/346
    • 没有文件格式后缀又不是文件夹如/
  • log/346.html/
    • 文件夹不能包括小数点

其实这个真的算不算是 Front-matter 配置问题,因为格式是正确的,只是值有冲突,而且在本地执行 hexo g 也是可以完成生成的。

为了解决 Google 搜索提供的 404 修正指南,针对一些死链增加了重定向。目前情况来看这种typecho生成的这种链接,在hexo暂时是无法优化了。

Relay Tips: 一极乐https://yijile.com/log/143/