Hexo - Tools & cmd used during deployment

Ref: https://caiyantao.gitee.io/2019/04/13/Hexo-%E4%B8%80/

npm CN image(taobao)

1
$ npm install -g cnpm --registry=https://registry.npm.taobao.org

Hexo installation

1
$ cnpm install -g hexo-cli

check if successfully installed

1
$ hexo -v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
hexo: 3.9.0
hexo-cli: 2.0.0
os: Windows_NT 10.0.16299 win32 x64
http_parser: 2.8.0
node: 10.16.0
v8: 6.8.275.32-node.52
uv: 1.28.0
zlib: 1.2.11
brotli: 1.0.7
ares: 1.15.0
modules: 64
nghttp2: 1.34.0
napi: 4
openssl: 1.1.1b
icu: 64.2
unicode: 12.1
cldr: 35.1
tz: 2019a
### Local init for first time setup
1
$ hexo init
### Start server and Run in browser
1
$ hexo s
Visit

Add ssh-key

Pass

When error generated (local compile)

1
2
3
$ hexo clean
$ hexo g # gengerate post to public folder
$ hexo s

Deploy to github

1
$ hexo d

Debug

  1. error:
    1
    2
    3
    Template render error: (unknown path)
    Error: expected end of comment, got end of file
    at Object._prettifyError (C:\Users\eshibij\p_blog\node_modules\nunjucks\src\lib.js:36:11)
    error occurs when generating, due to https://github.com/hexojs/hexo/issues/2070

hexo upgrade

for incompatible hexo version with node v14, need to upgrade hexo to v5.0+

Modify package.json file, inside dependencies braces:

1
2
3
4
5
6
7
8
9
10
11
12
13
"dependencies": {
"hexo": "^3.9.0",
"hexo-deployer-git": "^1.0.0",
"hexo-generator-archive": "^0.1.5",
"hexo-generator-category": "^0.1.3",
"hexo-generator-index-pin-top": "^0.2.2",
"hexo-generator-searchdb": "^1.0.8",
"hexo-generator-tag": "^0.2.0",
"hexo-renderer-ejs": "^0.3.1",
"hexo-renderer-marked": "^1.0.1",
"hexo-renderer-stylus": "^0.3.3",
"hexo-server": "^0.3.3"
}

change "hexo": "^3.9.0" -> "hexo": "^5.0.0"
UNNECESSARY to change

1
2
3
"hexo": {
"version": "3.9.0"
}

it will be updated to version above 5.0.0 after running npm update
after updating, check hexo version:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
$ hexo -v
INFO Validating config
hexo: 5.3.0
hexo-cli: 2.0.0
os: Windows_NT 10.0.18363 win32 x64
node: 14.6.0
v8: 8.4.371.19-node.12
uv: 1.38.1
zlib: 1.2.11
brotli: 1.0.7
ares: 1.16.0
modules: 83
nghttp2: 1.41.0
napi: 6
llhttp: 2.0.4
openssl: 1.1.1g
cldr: 37.0
icu: 67.1
tz: 2020a
unicode: 13.0