最近重装了电脑,于是把需要备份的资料进行备份,考虑到配置的隐私问题,我把Hexo博客托管到Bitbucket上。折腾了半天,也终于把Hexo架到了新装好的电脑上。在此记下,避免日后再次入坑:
0 安装npm
1 重新搭建Hexo环境:
1
| clone <your blog address repo>
|
1 2 3
| npm install hexo --save npm install hexo server --save npm install
|
npm install
是非常重要的,因为要在Hexo路径里面生成新的node环境,否则会出现can not find /GET的大白页面。
1
| npm install hexo-asset-image --save
|
hexo-asset-image 是一个很好用的图片管理插件,每次创建博客的时候会相应的创建一个与博文名同名的文件,在文件里放置图片,然后直接使用markdown图片链接语法 + 文件里的图片名就可以使用了。在使用前必须保证 _config.yml
里面的post_asset_folder
配置为true。
2 重新下载Theme(也许可以用git的submodule功能取代)
1
| clone https://github.com/tufu9441/maupassant-hexo.git themes/maupassant
|
- maupassant主题的配置需要在其目录中的
_config.yml
文件完成。我在theme/
路径下放置了一个备份文件夹theme_config.yml来备份主题的配置文件,所以每次就不需要重新修改了直接把备份文件内容传到maupassant主题下的_config.yml
里面就好
1
| less theme_config.yml > maupassant/_config.yml
|
1 2 3
| npm install hexo-renderer-jade@0.3.0 --save npm install hexo-renderer-sass --save npm install hexo-generator-search --save
|
3 处理本地npm及相关modules不兼容问题
由于npm或其他module版本不一样,可能导致弹出一些异常,可以通过删除node_modules/
文件夹然后使用npm i
命令重新安装一下本地的npm,通常情况下可以解决一些module不兼容的问题。