¶Preface
We have pointed out using git to backup our blogs’ content in the before articles: Use Hexo+Next+git build a blog system in GitHub page. The following will show the details of how to rebuild hexo+next blogs when switch to another PC or reinstall system.
¶Clone the backup files
I use the Linux system and have installed git service, so I can use git to clone my blog content from my private repository in csdn code:
1 | git clone https://gitee.com/absentm/hexo-note.git |
¶Download and install node and npm
Note: please use nodejs version 12.2.0 v12.2.0
Please visit these page to look for the details:node website and Install DOC
Install nodejs in ubuntu:
1 | curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - |
If you want to update inside npm, do
1 | sudo npm cache clean -f |
¶Set npm source from taobao
// Ubuntu
1 | sudo npm install -g npm --registry=https://registry.npm.taobao.org |
// Windows
1 | npm install -g npm --registry=https://registry.npm.taobao.org |
¶Install hexo and Plugins we need
1 | // install hexo |
¶Install email remind Plugins
1 | cd /hexo-notes/notes/emailCallbak |
¶Install article visit count Plugins
1 | sudo npm install --save hexo-generator-index |
¶Install article word count and read time Plugins
1 | sudo npm install hexo-symbols-count-time --save |
¶Install hexo-renderer-markdown-it
1 | See it in links [2], [3] |
¶Install hexo-tag-aplayer
1 | See it in links [4] |
¶Install sitemap Plugins
1 | sudo npm install hexo-generator-sitemap --save |
Note if meet the error as following:
if npm ERR! ENOTEMPTY: directory not empty, rename ‘/home/dm/hexo-notes/notes/node_modules/hexo-generator-sitemap’ -> ‘/home/dm/hexo-notes/notes/node_modules/.hexo-generator-sitemap.DELETE’
Solution: please rm -rf *.DELETE and reinstall.
¶Deploy
1 | cd /hexo-notes/notes/ |
¶Publish new article
1 | cd /hexo-notes/notes/ |
¶Issues
1/ bash: /dev/tty: No such device or address
if you deploy again, and meet the error follow:
1 |
|
Solution:
reinstall hexo-deployer-git:
1 | $ npm install hexo-deployer-git --save |
2/ use ssh with git
https met error or is slow, please use ssh for git.
¶Reference
[1] https://hexo.io/docs/troubleshooting.html
[2] https://www.jianshu.com/p/f9e57ecca150
[3] https://github.com/hexojs/hexo-renderer-markdown-it
[4] https://easyhexo.com/3-Plugins-use-and-config/3-1-hexo-tag-aplayer/#介绍