关于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部署操作。

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

相关推荐
深圳卢先生3 小时前
CentOS 安装jenkins笔记
笔记·centos·jenkins
u_topian4 小时前
【个人笔记】Qt使用的一些易错问题
开发语言·笔记·qt
WarPigs9 小时前
游戏框架笔记
笔记·游戏·架构
金心靖晨9 小时前
redis汇总笔记
数据库·redis·笔记
遇见尚硅谷10 小时前
C语言:20250714笔记
c语言·开发语言·数据结构·笔记·算法
Norvyn_710 小时前
LeetCode|Day11|557. 反转字符串中的单词 III|Python刷题笔记
笔记·python·leetcode
逼子格11 小时前
权电阻网络DAC实现电压输出型数模转换Multisim电路仿真——硬件工程师笔记
笔记·嵌入式硬件·硬件工程·硬件工程师·adc·硬件工程师真题·权电阻网络dac
Jyywww12111 小时前
慕尚花坊项目笔记
笔记
xd0000211 小时前
ethers.js-5–和solidity的关系
笔记
星辰大海141212 小时前
AI Linux 运维笔记
运维·笔记