关于hexo-deploy时Spawn-Failed的几种解决方案


title: 关于hexo deploy时Spawn Failed的几种解决方案

tags:

  • 技术踩坑
    abbrlink: 31824
    date: 2023-08-20 11:42:13

前言

昨天晚上,我兴致勃勃的打开了cmd窗口,准备写一篇有关了解Kaggle的博客,当我文思泉涌,啪嗒啪嗒地码完整篇文章,理所当然地执行hexo clean && hexo g && hexo d部署到github时,终端窗口冷不丁地弹出了几行绚丽的错误:

cmd 复制代码
Please make sure you have the correct access rights and the repository exists.
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Error: Spawn failed
    at ChildProcess.<anonymous> (D:\blog\hexo\node_modules\hexo-util\lib\spawn.js:51:21)
    at ChildProcess.emit (node:events:513:28)
    at cp.emit (D:\blog\hexo\node_modules\cross-spawn\lib\enoent.js:34:29)
    at ChildProcess._handle.onexit (node:internal/child_process:291:12)

解决方案

删除文件夹

网上的解决方案大多是这种,但是并没有解决我自己的问题,在此只是将其列出,作为一种通用方案。

原理:我们在进行git pushhexo d的时候改变了一些.deploy_git文件夹下的内容。

  1. 删除.deploy_git文件夹
  2. cmd中输入git config --global core.autocrlf false
  3. 依次执行hexo clean&&hexo g&&hexo d

问题解决,皆大欢喜,如果错误依旧,请参考下面的方法。

github端口问题

验证:我们正常使用git pull进行拉取,终端中会显示下面的错误:

cmd 复制代码
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

这个错误提示的是连接github.com的22端口被拒绝了。

由于22端口可能被防火墙屏蔽了,我们可以尝试连接github的443端口。

如果没有.ssh文件夹,可参考Github生成密钥,了解ssh的作用。

  1. 我们打开C盘中的.ssh文件夹,在其中新建config文件,注意这个文件没有后缀,编辑其内容为:
txt 复制代码
Host github.com
User git
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443

Host gitlab.com
Hostname altssh.gitlab.com
User git
Port 443
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
  1. 修改完成后,在终端中敲入ssh -T git@github.com来测试和Github的网络通信是否正常,如果有下面的提示,就表示一切正常了:
cmd 复制代码
D:\blog\hexo>ssh -T git@github.com
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Hi yanzhuang-h! You've successfully authenticated, but GitHub does not provide shell access.

接下来我们便可以尝试正常的blog部署操作。

关于其他的方法,后续我看到了将会继续总结到此片博客中。

相关推荐
Dream Algorithm7 小时前
价格在走盘整,但是头寸持仓量增加说明什么
笔记
Radan小哥8 小时前
Docker学习笔记—day007
笔记·学习·docker
Rsingstarzengjx8 小时前
PS 笔记1
笔记
㱘郳9 小时前
软考软件设计师笔记
笔记·软件工程
嵌入式学习者。9 小时前
Eplan自学笔记1
笔记
风123456789~10 小时前
【OceanBase专栏】OceanBase 外部表实验
数据库·笔记·oceanbase
暮乘白帝过重山11 小时前
ArkTS 关键字速查笔记
笔记·arkts
Wild_Pointer.11 小时前
技术书籍精读笔记:全景目录
笔记
d111111111d11 小时前
W25Q60简介--SPI通信(笔记)
笔记·stm32·单片机·嵌入式硬件·学习
打工人你好11 小时前
Android 应用逆向分析与架构研究笔记
android·笔记·架构