hexo d部署网站时出现错误Error: Spawn failed(生成失败)

关于博客使用过程中,进行远端部署时使用hexo d指令后可能会遇到的错误有很多,其中最常见的就是类似于下面Error: Spawn failed的错误。

1
2
3
4
5
6
7
8
9
10
11
12
13
ssh: connect to host github.com port 22: Connection refused
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
FATAL {
err: Error: Spawn failed
at ChildProcess.<anonymous> (/Users/tingyu/blog/node_modules/hexo-util/lib/spawn.js:51:21)
at ChildProcess.emit (node:events:527:28)
at ChildProcess._handle.onexit (node:internal/child_process:291:12) {
code: 128
}
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html

解决方案(一)

1.在博客文件夹下删除 .deploy_git 文件

rm -rf .deploy_git/

2.git config --global core.autocrlf false 把git加入系统环境变量

3.重新执行hexo c hexo g hexo d

解决方案(二)

更换网络,用稳定的网络,避免因网络不流畅而导致部署超时。

这里我是连接了ECNU的VPN然后再提交就好了(hexo提交不需要连接VPN提交的,这次不知道怎么报错了)

hexo c hexo g hexo d

解决方案(三)

有可能是你的git repo配置地址不正确,可以将http方式变更为ssh方式

如果之前hexo d部署都没问题,就不是git repo配置的地址不对了,去解决方案(二)看看

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
##进入站点根目录
cd /Users/tingyu/blog/

##删除git提交内容文件夹
vim _config.yml

##修改
deploy:

type: git

repo: https://github.com/yourname/yourname.github.io.git -> git@github.com:a956551943/weixiaohui.github.io.git

branch: master

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

觉得不错的话,给点打赏吧 ୧(๑•̀⌄•́๑)૭



wechat pay



alipay

hexo d部署网站时出现错误Error: Spawn failed(生成失败)
http://yuting0907.github.io/2023/01/16/hexo-d部署网站时出现错误Error-Spawn-failed-生成失败/
作者
Echo Yu
发布于
2023年1月16日
许可协议