记使用hexo搭建个人博客-报错集锦

  使用hexo+github/coding+next搭建个人博客过程中遇到的一些问题集中整理,包括:

  • 报错一:TypeError: Cannot set property 'lastIndex' of undefined
  • 报错二:Permission denied (publickey).
  • 报错三:Error: ERROR: Repository not found. fatal: Could not read from remote repository.

报错一:TypeError: Cannot set property ‘lastIndex’ of undefined

问题描述:使用hexo g 报错

TypeError: Cannot set property ‘lastIndex’ of undefined

hexo-coding-github-报错集锦
问题处理:在hexo中的_config.yml 文件中的高亮功能设置错了,不是主题的_config.yml,其中的 auto_detect 应该设置为 false。

1
2
3
4
5
highlight:
enable: true
line_number: true
auto_detect: false
tab_replace:

改过之后再执行就好了。

报错二: Permission denied (publickey).

问题处理:
第一步:创建SSH Key。windows下的目录C:\Users\用户名.ssh,看看有没有.ssh目录,,如果有,再看看这个目录下有没有id_rsaid_rsa.pub这两个文件,如果已经有了,可直接跳到下一步。如果没有,打开Shell(Windows下打开Git Bash),创建SSH Key:

1
ssh-keygen -t rsa -C "ne_lucifer@163.com"

你需要把邮件地址换成你自己的邮件地址,然后点击回车,使用默认值即可。
第二步:登录Github(登录后路径https://github.com/settings/keys)或者Coding(登录后路径),按如下步骤操作,用记事本打开id_rsa.pub,全选,把里面的内容粘贴到公钥内容里,title随便起一个
hexo-coding-github-报错集锦2-1
hexo-coding-github-报错集锦2-2

报错三: Error: ERROR: Repository not found. fatal: Could not read from remote repository.

问题描述:使用hexo d部署项目到pages服务时报错

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Please make sure you have the correct access rights
and the repository exists.
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
at ChildProcess.<anonymous> (F:\WorkSpaces\hexo\blog\node_modules\hexo-util\lib\spawn.js:37:17)
at ChildProcess.emit (events.js:182:13)
at ChildProcess.cp.emit (F:\WorkSpaces\hexo\blog\node_modules\cross-spawn\lib\enoent.js:40:29)
at maybeClose (internal/child_process.js:962:16)
at Socket.stream.socket.on (internal/child_process.js:381:11)
at Socket.emit (events.js:182:13)
at Pipe._handle.close (net.js:606:12)

查看远端有没有这个分支;
使用ssh -T git@git.coding.net命令,会出现下面信息,输入yes然后回车即可部署。

1
2
3
The authenticity of host 'git.coding.net (118.25.166.124)' can't be established.
RSA key fingerprint is SHA256:这块是一串编码.
Are you sure you want to continue connecting (yes/no)?