前言
买了新的电脑。hexo塔建的博客需要迁移到新的电脑上来。
复制
把之前旧电脑上的blog文件夹,复制到硬盘里。然后将以下几个文件复制到新电脑的博客文件夹
_config.yml
themes
source
scaffolds
package.json
就要这个几个,其余的咱都不要。
npm install
在博客目录下依次执行
npm install
npm install hexo-deployer-git --save # 为了使用hexo d来部署到git上
npm install hexo-generator-feed --save # 为了建立RSS订阅
npm install hexo-generator-sitemap --save # 为了建立站点地图
你以为搞定了
依次执行
hexo g
hexo s
hexo d
惊喜
什么是惊喜,惊喜就是你以为搞定了,上面命令都执行成功了,新写的文章一直发布不到博客上。原因是hexo s的时候报了一个不起眼的警告,大致如下。
INFO Start processing
WARN ===============================================================
WARN ========================= ATTENTION! ==========================
WARN ===============================================================
WARN NexT repository is moving here: https://github.com/theme-next
WARN ===============================================================
WARN It's rebase to v6.0.0 and future maintenance will resume there
WARN ===============================================================
INFO Hexo is running at http://localhost:4000/. Press Ctrl+C to stop.
(node:12921) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:12921) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:12921) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:12921) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(node:12921) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:12921) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
这是因为node版本和之前不统一,新电脑上的node版本太高了,你得在装一下低一点的,想想之前的版本大概是多少。
安装 n
n是node版本管理工具
sudo npm install -g n
安装你需要的node版本
sudo n <node版本号>
例如:
sudo n 12.0.0
查看自己node版本
n ls
切换node版本
n (是的直接一个n完事,会出现已有的node版本供你选择)
其他命令
// 安装最新版本
sudo n latest
// 安装稳定版本
sudo n stable
// 删除某个版本
sudo n rm <版本号>
重新执行
依次执行
hexo g
hexo s
hexo d