将你原来电脑上已经配置好并生成的hexo目录拷到你的新电脑上,注意无需拷全部.

1.拷贝文件

更换电脑后只拷如下几项

_config.yml
package.json
scaffolds/
source/
themes/

2.配置环境

在你的新电脑上首先配置hexo环境:安装Node.js
前往node.js中文站点下载安装即可

3. 换源

安装后node.js后更换npm源或者使用cnpm

#更换源为淘宝的npm源
npm config set registry https://registry.npm.taobao.org
#使用cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org

4. 安装

安装hexo,执行命令,我这里使用的是cnmp,也可以使用npm

#npm安装
npm install -g hexo-cli
#cnpm安装
cnpm install -g hexo-cli

初始化hexo

#init后hexo是文件夹名
hexo init hexo

安装好之后,进入hexo目录

cd hexo

5. 安装模块

执行以下命令

cnpm install
cnpm install hexo-deployer-git --save
cnpm install hexo-generator-feed --save
cnpm install hexo-generator-sitemap --save
cnpm install hexo-generator-baidu-sitemap --save

如果你使用的主题是 BlueLake 主题,由于BlueLake是基于jade和stylus写的,所以需要安装hexo-renderer-jade和hexo-renderer-stylus来渲染。

cnpm install hexo-renderer-jade@0.3.0 --save
cnpm install hexo-renderer-stylus --save

6. 部署

执行以下命令

hexo g
hexo d
最后修改:2019 年 03 月 18 日
如果觉得我的文章对你有用,请随意赞赏