hexo使用icarus主题

本文记录了将博客主题切换为icarus过程中遇到的问题及解决办法。

切换icarus主题

参考该文章安装nodejs,然后建立GitHub hexo仓库,发布第一篇hello world文章:超详细Hexo+Github博客搭建小白教程 - 知乎 (zhihu.com)

已有博客,想直接切换主题

如果是在旧的hexo博客文件夹下直接切换主题可能会出错,建议备份好文章后再切换。

比如我直接切换就遇到了下面这个问题:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const { Component } = require("inferno");
const classname = require("hexo-component-inferno/lib/util/classname");
const Head = require("./common/head");
const Navbar = require("./common/navbar");
const Widgets = require("./common/widgets");
const Footer = require("./common/footer");
const Scripts = require("./common/scripts");
const Search = require("./common/search");
module.exports = class extends Component {
render() {
const { site, config, page, helper, body } = this.props;
const language = page.lang || page.language || config.language;
const columnCount = Widgets.getColumnCount(config.widgets);
return;
}
};

一番搜索过后,有说是nodejs版本太高导致icarus主题没跟上的,我降了一个大版本后依然报错,继续搜索,发现主题作者建议重新新建一个空白hexo目录,然后把文章迁移过去。hexo icarus 主题安装使用中遇到的问题以及解决方案 - 简书 (jianshu.com)

新开博客,直接使用icarus主题

接着上面, 文中提到npm install hexo-theme-icarus实际上并没有将icarus主题下载到themes文件夹下,在hexo目录下执行git clone https://github.com/ppoffice/hexo-theme-icarus.git themes/icarus,可以解决,也可以在release下面下载压缩包,解压重命名后手动移至themes文件夹下。

然后hexo g之后hexo s,在浏览器中访问http://localhost:4000/ ,搭建成功。

安装过程中的问题

npm install安装不成功、版本不一致

npm install报错的话就把冲突的模块uninstall掉,再安装正确的版本。

Error: EISDIR: illegal operation on a directory, read

参考:ERROR Plugin load failed: hexo-admin Error: EISDIR: illegal operation on a directory, read ERROR Dep_不忘初心,砥砺前行-CSDN博客

使用npm install --save hexo-admin即可。

ERROR Deployer not found: git

安装npm install hexo-deployer-git即可。

作者

BaldStrong

发布于

2022-02-21

更新于

2022-02-22

许可协议

评论