在前一段时间决定更新hexo用的butterfly主题之后,我发现我使用的nodejs12版本不再被主题所支持

因此不得不选择更新主题。但是更新了最新的nodejs之后,发现了几个问题

首先是使用hexo g命令进行生成的时候出现了如下的警告

1
2
3
4
5
6
7
(node:3125) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3125) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:3125) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:3125) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(node:3125) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:3125) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency

似乎叫做什么循环依赖的问题。。经过多方查找资料。。最终,没有解决。。

因为不影响使用,外加懒得折腾,所以决定就这样用

再有就是无法使用hexo douban来获取这些数据了。。不知道是因为我获取太过于频繁被封ip还是什么原因。。因此决定去掉这部分展示

这些都是可以忍受的小问题。。但是当我在本地hexo server检查没有其他问题准备使用hexo de准备上传的时候,问题出现了

上传到一半之后停止了

1
2
3
4
5
Hexo de
INFO Validating config
INFO Deploying: git
INFO Clearing .deploy_git folder...
INFO Copying files from public folder...

查询这个问题之后,发现这个问题似乎在之前也出现过,但是并不知道具体原因是什么。。

我尝试过网路上的删除db.json文件,使用全局代理,都无法解决

然后又看到了一个命令叫做hexo de -debug

然后发现一直循环执行 start processing :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
INFO  Start processin
INFO Files loaded in 27 ms
INFO 0 files generated in 25 ms
INFO Start processing
INFO Files loaded in 26 ms
INFO 0 files generated in 59 ms
INFO Start processing
INFO Files loaded in 25 ms
INFO 0 files generated in 22 ms
INFO Start processing
INFO Files loaded in 36 ms
INFO 0 files generated in 19 ms
INFO Start processing
INFO Files loaded in 31 ms
INFO 0 files generated in 22 ms
INFO Start processing
INFO Files loaded in 31 ms
INFO 0 files generated in 19 ms
INFO Start processing
INFO Files loaded in 29 ms
INFO 0 files generated in 19 ms
INFO Start processing

对于这个问题并没有找到合适与于我的解决方法

我稍微想了一下这个命令。。无非就是public文件拷贝到.deploy_git文件夹,并将其内部的文件上传到github。。

那这个操作完全可以用git来实现

查询了一下hexo de的原理,果然和我想的是一样的。。

那么根据之前掌握的git的用法。。配置好git的config

1
2
git config --global user.name "你的GitHub用户名"
git config --global user.email "你的GitHub注册邮箱"

然后使用命令ssh-keygen -t rsa -C "上边的邮箱"。点击三次回车(大概是三次?

打开~/.ssh/文件夹中的id_rsa.pub文件。。复制里边的内容

打开github的SSH and GPG keys页面,点击右上角的绿色New SSH key按钮,将复制好的内容粘贴到Key栏目中,在Title栏目输入一个自己喜欢的名字

保存好之后,回到terminal中使用ssh [email protected]这条命令来尝试一下,如果能看到Hi +你的名字字样就证明成功了

然后就可以回到blog所在的目录了,然后首先执行hexo deploy,让hexo帮忙从public复制到.deploy_git文件夹,然后手动进入这个文件夹手动push,最后再返回上一层,具体指令如下

1
hexo deploy && cd .deploy_git && git add . && git commit -m "`date +%Y-%m-%d,%H:%M:%S`" && git push && cd ../

虽然问题是解决了,但是总觉得每次都要输入那么长的指令很不爽,所以我干脆直接在blog目录下新建了一个dd.sh文件,内容如下

1
hexo deploy && cd .deploy_git && git add . && git commit -m "`date +%Y-%m-%d,%H:%M:%S`" && git push && cd ../

这样每次写完文章之后直接在terminal中执行./dd.sh这一个命令就好啦w

那么我又成功的水了一篇文章