Hexo Error: error: spawn failed [How to Solve]

Problem description

First, an error occurred:

error:spawn failed...

After some blog operations, the following problems will occur:

fatal: cannot lock ref 'HEAD': unable to resolve reference HEAD: Invalid argument error: src refspec


error: src refspec HEAD does not match any.

The following picture is an error report after uploading GitHub by myself hexo d:

  err: Error: Spawn failed
      at ChildProcess.<anonymous> (D:\Program Files\blog\node_modules\hexo-util\lib\spawn.js:51:21)
      at ChildProcess.emit (node:events:526:28)
      at ChildProcess.cp.emit (D:\Program Files\blog\node_modules\cross-spawn\lib\enoent.js:34:29)
      at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12) {
    code: 128
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html

Cause analysis:

The problem is mostly due to git doing a push or hexo d and changing some of the content under the .deploy_git file.


Solution: 1

1. Delete .deploy_git folder
2. Enter git config --global core.autocrlf false
3. Then, execute in sequence:

hexo clean
hexo g
hexo d

Solution: 2

1. Enter the hexo root directory
2 Direct the arrow to .deploy_git and public are deleted directly

3. Then, execute in sequence:

hexo clean
hexo g
hexo d

Be careful!!: Deleting these two folders will not affect you! After the implementation of hexo, the third company will redeploy simple violence!

Read More: