hexo d时出现Error Spawn failed 报错解决

hexo d时出现Error Spawn failed 报错解决

运行hexo d命令时报错

1
2
3
4
5
6
7
8
FATAL {
err: Error: Spawn failed
at ChildProcess.<anonymous> (/usr/local/src/hexo/hanyubolg/node_modules/hexo-util/lib/spawn.js:51:21)
at ChildProcess.emit (events.js:376:20)
at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) {
code: 128
}
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html

网上的解决方法:

1
2
3
4
5
6
7
8
##删除git提交内容文件夹
rm -rf .deploy_git/

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

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

试过很多遍,还是无效。

又看到有人说,是因为网络延迟的问题,当我执行ssh命令时

1
$ ssh git@github.com

出现以下信息:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for github.com has changed,
and the key for the corresponding IP address 140.82.113.4
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s.
Please contact your system administrator.
Add correct host key in /c/Users/shj/.ssh/known_hosts to get rid of this message.
Offending RSA key in /c/Users/shj/.ssh/known_hosts:1
RSA host key for github.com has changed and you have requested strict checking.
Host key verification failed.

上面这个错误提示意味着连接到的 GitHub 服务器的 RSA 主机密钥(host key)已经改变,可能是由于 DNS 欺骗攻击或 GitHub 服务器的 IP 地址和主机密钥同时更改导致的。

最终的解决方法:

我决定重新生成ssh密钥:

1
2
git config --global user.name "你的GitHub用户名"
git config --global user.email "你的GitHub注册邮箱"

生成ssh密钥文件:

1
ssh-keygen -t rsa -C "你的GitHub注册邮箱"

找到生成的.ssh文件夹中的id_rsa.pub中的密钥内容,并复制(该文件的地址可以从图中看到)

image-20230605170731920

打开github中SSH and GPG keys页面,将原先的密钥删除,并新建new SSH Key,标题随便填,将复制的内容填入下面的框中,即可生成新的密钥。

image-20230605171128126

然后运行下面两个命令:

1
2
ssh-keygen -R github.com
ssh-keyscan github.com >> ~/.ssh/known_hosts

第一条命令将删除已知主机密钥,第二条命令将从 GitHub 获取新的主机密钥并将其添加到你的已知主机列表中。再次运行以下命令,

1
$ ssh git@github.com

运行后出现下面信息:

image-20230605171907495

SSH 连接已经成功建立并通过身份验证。然而,由于 GitHub 不提供 shell 访问权限,因此连接被关闭了。这是正常的行为,因为当使用 SSH 连接到 GitHub 时,只能执行特定的 Git 命令,而不能像连接到普通的远程服务器一样执行任意的命令。

之后执行

1
2
3
hexo clean
hexo g
hexo d

就可以正常部署了。

作者

John Doe

发布于

2023-06-05

更新于

2025-02-28

许可协议

You need to set install_url to use ShareThis. Please set it in _config.yml.
You forgot to set the business or currency_code for Paypal. Please set it in _config.yml.

评论

You forgot to set the shortname for Disqus. Please set it in _config.yml.
You need to set client_id and slot_id to show this AD unit. Please set it in _config.yml.