关于hexo-renderer的坑

之前一直用的windows,写hexo文章,前段时间换了linux。

结果同样的文章,在linux上渲染出来变成了一片空白,windows上却正常。

有点让我摸不着头脑。我觉得可能是两边nodejs的插件版本不一样。一度想要把windows上的nodejs工作环境用docker打包,然后在linux上运行,但是不太会nodejs,不知道怎么打包哪些东西。(其实是菜加懒)

运行npm ls --depth 0查看两边的nodejs插件版本。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
E:\blog\blog_github_action>npm ls --depth 0
npm ERR! code ELSPROBLEMS
npm ERR! extraneous: bindings@1.5.0 E:\blog\blog_github_action\node_modules\bindings
npm ERR! extraneous: file-uri-to-path@1.0.0 E:\blog\blog_github_action\node_modules\file-uri-to-path
npm ERR! missing: gitalk@^1.8.0, required by hexo-site@0.0.0
npm ERR! invalid: hexo-renderer-stylus@3.0.0 E:\blog\blog_github_action\node_modules\hexo-renderer-stylus
npm ERR! extraneous: nan@2.18.0 E:\blog\blog_github_action\node_modules\nan
hexo-site@0.0.0 E:\blog\blog_github_action
├── bindings@1.5.0 extraneous
├── file-uri-to-path@1.0.0 extraneous
├── UNMET DEPENDENCY gitalk@^1.8.0
├── gulp-clean-css@4.3.0
├── gulp-html-minifier-terser@7.1.0
├── gulp-htmlclean@2.7.22
├── gulp-terser@2.1.0
├── gulp@4.0.2
├── hexo-abbrlink@2.2.1
├── hexo-algoliasearch@2.0.1
├── hexo-blog-encrypt@3.1.9
├── hexo-butterfly-envelope@1.0.15
├── hexo-butterfly-footer-beautify@1.0.6
├── hexo-butterfly-tag-plugins-plus@1.0.17
├── hexo-generator-archive@2.0.0
├── hexo-generator-category@2.0.0
├── hexo-generator-index@3.0.0
├── hexo-generator-tag@2.0.0
├── hexo-pdf@1.1.1
├── hexo-renderer-ejs@2.0.0
├── hexo-renderer-kramed@0.1.4
├── hexo-renderer-pug@3.0.0
├── hexo-renderer-stylus@3.0.0 invalid: "^3.0.1" from the root project
├── hexo-server@3.0.0
├── hexo-tag-aplayer@3.0.4
├── hexo-tag-map@1.2.1
├── hexo-theme-landscape@1.0.0
├── hexo-wordcount@6.0.1
├── hexo@7.0.0
└── nan@2.18.0 extraneous


npm ERR! A complete log of this run can be found in: C:\Users\xxx\AppData\Local\npm-cache\_logs\2024-01-18T01_04_39_955Z-debug-0.log

E:\blog\blog_github_action>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$ npm ls --depth 0
hexo-site@0.0.0 /home/xxxxx/workspace/hexo-blog-source
├── bindings@1.5.0 extraneous
├── file-uri-to-path@1.0.0 extraneous
├── gitalk@1.8.0
├── gulp-clean-css@4.3.0
├── gulp-html-minifier-terser@7.1.0
├── gulp-htmlclean@2.7.22
├── gulp-terser@2.1.0
├── gulp@4.0.2
├── hexo-abbrlink@2.2.1
├── hexo-algoliasearch@2.0.1
├── hexo-blog-encrypt@3.1.9
├── hexo-butterfly-envelope@1.0.15
├── hexo-butterfly-footer-beautify@1.0.6
├── hexo-butterfly-tag-plugins-plus@1.0.17
├── hexo-generator-archive@2.0.0
├── hexo-generator-category@2.0.0
├── hexo-generator-index@3.0.0
├── hexo-generator-tag@2.0.0
├── hexo-pdf@1.1.1
├── hexo-renderer-ejs@2.0.0
├── hexo-renderer-kramed@0.1.4
├── hexo-renderer-pug@3.0.0
├── hexo-renderer-stylus@3.0.0
├── hexo-server@3.0.0
├── hexo-tag-aplayer@3.0.4
├── hexo-tag-map@1.2.1
├── hexo-theme-landscape@1.0.0
├── hexo-wordcount@6.0.1
├── hexo@7.0.0
└── nan@2.18.0 extraneous

hexo-renderer-stylus是我最近更新的,这个不用管。

因为是有package-lock.json的,linux那边也是npm install --save安装的,所以应该是一样的。

最后发现:是一个空格的问题

1
2
3
4
5
6
7
8
9
10
11
12
---
title: "解决 Github SSH 连接超时"
tags:
- Github
- SSH
- 连接超时
categories:
- 记录
- 踩坑
abbrlink: '71e1'
date: 2024-01-17 21:46:38
---

所以推荐以后在写文章的时候,文章的头部信息,最好都用双引号包起来,就像终端字符串要用双引号包起来一样,免得空格被识别为分割符。