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

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

相关推荐
爱奥尼欧37 分钟前
【Linux笔记】网络部分——传输层协议TCP(2)
linux·网络·笔记·tcp/ip
郝学胜-神的一滴1 小时前
QAxios研发笔记(二):在Qt环境下基于Promise风格简化Http的Post请求
开发语言·c++·笔记·qt·网络协议·程序人生·http
大白的编程日记.1 小时前
【Linux学习笔记】线程安全问题之单例模式和死锁
linux·笔记·学习
JJJJ_iii1 小时前
【机器学习12】无监督学习:K-均值聚类与异常检测
人工智能·笔记·python·学习·机器学习·均值算法·聚类
idaretobe2 小时前
全局埋点需求
笔记
pedestrian_h2 小时前
docker快速上手笔记
笔记·docker·容器
sponge'4 小时前
opencv学习笔记8:haar特征、决策树、adaboost初步认识
笔记·opencv·学习
蒙奇D索大10 小时前
【计算机网络】408考研核心考点:物理层设备(中继器/集线器)深入解析
经验分享·笔记·计算机网络·考研·改行学it
code_ing-12 小时前
【Linux】命令行参数与环境变量
linux·c++·windows·笔记
bnsarocket14 小时前
Verilog和FPGA的自学笔记9——呼吸灯
笔记·fpga开发·verilog·自学·硬件编程