Hexo博客的迁移
Hexo博客的迁移
当我们更换电脑或重装系统后,基于Hexo的个人博客可以通过以下方法来迁移
-
将原来的博客目录拷贝到新的环境下
-
安装git,并添加github、gitee公钥,见Git的安装和配置
-
安装nodejs
-
安装hexo
1
npm install hexo-cli -g
-
进到新的环境下,安装相应的模块
1
2npm install
npm install hexo-deployer-git --save -
之后就可以在原来的基础上继续执行了
遇到的问题
-
如果在使用
hexo g -d
时,报以下警告:1
2
3
4warning: LF will be replaced by CRLF in xxx
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in xxx
The file will have its original line endings in your working directory-
问题原因:git提供的换行符自动转换功能,将LF格式的换行符转化为CRLF
-
解决方案:关掉自动转换功能
1
2git config core.autocrlf false # (仅对当前git仓库有效)
git config --global core.autocrlf false # (全局有效,不设置推荐全局) -
本问题的解决参考了man_zuo的博客
-
-
如果在使用
hexo s
时,报以下警告:1
2
3
4
5
6
7
8
9INFO Start processing
INFO Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.
(node:7136) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:7136) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:7136) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:7136) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(node:7136) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:7136) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency-
问题原因:在
node.js 14
中,修改了这个问题:module: warn on using unfinished circular dependency by addaleax · Pull Request #29935 · nodejs/node (github.com),waring具体是由stylus/stylus: Expressive, robust, feature-rich CSS language built for nodejs (github.com)导致的,并且已经修复了 -
解决方案:
-
方案1:将
node.js
降级到node.js 12
:卸载node.js
并重新安装一个版本号较低的 -
方案2:重装
hexo-renderer-stylus
:1
2npm uninstall hexo-renderer-stylus
npm install hexo-renderer-stylus -g
-
-
本问题的解决参考了【好一则博】的博客
-
Comment