关于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 天前
三大基础无源电子元件——电阻(R)、电感(L)、电容(C)
笔记
Alice-YUE3 天前
【CSS学习笔记3】css特性
前端·css·笔记·html
2303_Alpha3 天前
SpringBoot
笔记·学习
Hello_Embed3 天前
STM32HAL 快速入门(二十):UART 中断改进 —— 环形缓冲区解决数据丢失
笔记·stm32·单片机·学习·嵌入式软件
咸甜适中3 天前
rust语言 (1.88) 学习笔记:客户端和服务器端同在一个项目中
笔记·学习·rust
Grassto3 天前
RAG 从入门到放弃?丐版 demo 实战笔记(go+python)
笔记
Magnetic_h3 天前
【iOS】设计模式复习
笔记·学习·ios·设计模式·objective-c·cocoa
周周记笔记3 天前
学习笔记:第一个Python程序
笔记·学习
丑小鸭是白天鹅3 天前
Kotlin协程详细笔记之切线程和挂起函数
开发语言·笔记·kotlin
潘达斯奈基~3 天前
《大数据之路1》笔记2:数据模型
大数据·笔记