hexo 版本更新之后,部分模块失效

错误原因:

hexo 版本更新之后,部分模块会因为新特性的改动而失效

解决方案:

npm 全面更新所依赖的工具库即可

1
npm update

执行命令 hexo server,提示:Usage: hexo …. 提示找不到该指令

解决方法: 在 Hexo 3.0 后 server 被单独出来了,需要安装 server,安装的命令如下:

1
npm install hexo-server –save  

安装此 server 后再试,问题解决。

执行:hexo server,启动了服务,在浏览器输入本地地址访问,看到白板和 Cannot GET / 几个字

原因是由于 2.6 以后就更新了,我们需要手动配置些东西,我们需要输入下面三行命令:

1
2
3
4
5
npm install hexo-renderer-ejs --save

npm install hexo-renderer-stylus --save

npm install hexo-renderer-marked --save

这时候重新启动本地服务在访问。
或者: 在空文件夹下,执行

1
hexo init -- npm install

端口被占用

错误原因:

localhost:4000 端口被占用

解决方案:

可执行 hexo s -p 5000 修改成 5000 端口

YAMLException: incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line at line 1, column 33:

解决方案:

(1)出现这种情况,一般都是缺少空格,在: 冒号之后要有空格!检查 x 行 y 列附近的冒号,其之后是否跟了空格。
(2)仔细检查_config.yml 文件中所有冒号后面的空格,格式很严格,必须是只有一个,半角。不管是多了还是少了都会报错,这是 yml 解释器所定义的语法。如果不确定的话,将输入法调整到英文模式,删除所有冒号后面的空格重新输入,不要使用 Tab。

ValidationError: ‘null’ is not a string!

解决方案:

一般都是因为文章无内容,可能是因为在这篇博客文章中,有某些属性没有填写,比如 author 属性,tag 属性,categories 属性等,导致该属性是空的,即 null,所以报错。
友情提示:如果你是用 MarkdownPad 2 来进行博文写作,可能在打开该 md 文件之后,对文件名进行了修改,导致出现了两篇文章。就会出现错误。

执行 hexo g 命令后,报错:incomplete explicit mapping pair; a key node is missed

解决方案:

主题目录下所有 yml 文件中所有有空格的字段都用双引号括起来,尤其注意 languages 下面的 yml 文件。

系统升级 nodejs 后,项目中的 node-sass 报错的问题

起因:
在 Manjaro 系统自动更新了一波之后,准备执行 hexo g,发生了以下错误

1
2
3
4
5
6
7
Module build failed: Error: Missing binding 

Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 13.x

Found bindings for the following environments:

Linux 64-bit with Node.js 10.x

解决办法:

1
npm rebuild node-sass

extends includes/layout.pug block content

1
2
3
extends includes/layout.pug block content   
recent-posts.recent-posts include includes/recent-posts.pug include includes/pagination.pug
aside_content.aside_content include includes/aside.pug

解决方法:请下载安装

1
npm install hexo-renderer-pug hexo-renderer-stylus --save

報錯 wordcount is not a function

請檢查是否安裝了 wordcount 插件

1
npm i --save hexo-wordcount

to be continued…