Hexo博客部署出错
Tsccai Lv2

很久没有写博客了,突然发现部署到github都出问题了。这个配置我没有动过,不知道什么原因。在网上搜索了很多资料,现在问题解决了,记录下来。

1. Error: Spawn failed

这个错误的症状是在执行部署命令hexo d后,控制台大量刷文件换行符的告警,大量的文件将有LF换行符替换为CRLF换行符。

BASH
1
2
3
4
5
6
7
8
9
FATAL {
err: Error: Spawn failed
at ChildProcess.<anonymous> (E:\Documents\Git Projects\Remote\hexo-blog\node_modules\hexo-util\lib\spawn.js:51:21)
at ChildProcess.emit (node:events:390:28)
at ChildProcess.cp.emit (E:\Documents\Git Projects\Remote\hexo-blog\node_modules\cross-spawn\lib\enoent.js:34:29)
at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) {
code: 128
}
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html

解决方式如下:将hexo博客目录下的.deploy_git目录删除,再执行git命令,关闭自动替换换行符功能即可。

BASH
1
2
3
4
5
6
7
8
9
10
11
##进入站点根目录
cd /usr/local/src/hexo-blog/

##删除git提交内容文件夹
rm -rf .deploy_git/

##执行
git config --global core.autocrlf false

##最后
hexo clean && hexo g && hexo d

2. fatal: unable to auto-detect email address

报错如图:

解决方法为进入hexo博客所在目录,在子目录.deploy_git/.git目录中编辑config文件,添加如下配置节

BASH
1
2
3
[user]
email="Your Github sign in email"
name="Your Github username"