个人博客搭建之九:hexo_6.3及next_8.13.0版本更新

涉及到本博客所用以下工具,更新到最新版本:

  • git: 2.37.3
  • node.js: 16.17.1
  • hexo: 6.3.0
  • webpack: 5.74.0
  • next: 8.13.0
  • npm: 5.74.0

hexo安转的前提条件:已安装Node.jsGit,而且对Node.js的版本有要求。

官方:强烈建议永远安装最新版本的 Hexo,以及推荐的 Node.js 版本。

更新 git 和 node.js

Git 版本更新:2.36.1 --> 2.37.3

https://git-scm.com/download/win 下载Git-2.37.3-64-bit.exe,全部默认更新安装

Node.js 版本(LTS)更新:16.15.1 --> 16.17.1

下载,全部默认更新安装;勾选:“自动安装必要工具”。 自动安装必要工具

npm的版本未随Node.js更新:8.11.0

1
2
3
4
5
6
7
8
$ git version
git version 2.37.3.windows.1

$ node -v
v16.15.1

$ npm -v
8.11.0

更新 HEXO

版本检查

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
========================================
NexT version 8.12.1
========================================
hexo: 6.2.0
hexo-cli: 4.3.0
os: win32 10.0.19044
node: 16.15.1
v8: 9.4.146.24-node.21
uv: 1.43.0
zlib: 1.2.11
brotli: 1.0.9
ares: 1.18.1
modules: 93
nghttp2: 1.47.0
napi: 8
llhttp: 6.0.4
openssl: 1.1.1o+quic
cldr: 40.0
icu: 70.1
tz: 2021a3
unicode: 14.0
ngtcp2: 0.1.0-DEV
nghttp3: 0.1.0-DEV

注:Hexo 与 Hexo-cli 的关系

Hexo-cli is a cli (command-line-interface) service for create a project. When project was created, all the things doing with hexo module.

hexo-cli 最新版 4.3.0,无需更新。 https://github.com/hexojs/hexo-cli/releases

hexo 最新版 6.3.0,需更新。 https://github.com/hexojs/hexo/releases

更新操作

  1. 进入 Hexo (blog) 的目录,npm outdated检查一下有哪些 Package 已经过期了:

    1
    2
    3
    4
    $ npm outdated
    Package Current Wanted Latest Location Depended by
    hexo 6.2.0 6.3.0 6.3.0 node_modules/hexo Blog
    hexo-theme-next 8.12.1 8.13.0 8.13.0 node_modules/hexo-theme-next Blog

    主题现在是以nodejs包的形式存在,所以可通过npm管理之。

  2. npm update更新之:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    $ npm update
    added 7 packages, removed 5 packages, changed 21 packages, and audited 191 packages in 16s

    3 moderate severity vulnerabilities

    To address all issues (including breaking changes), run:
    npm audit fix --force

    Run `npm audit` for details.
    npm notice
    npm notice New minor version of npm available! 8.11.0 -> 8.19.2
    npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.19.2>
    npm notice Run `npm install -g npm@8.19.2` to update!
    npm notice

    似乎不仅仅更新了hexohexo-renderer-stylus;警告信息暂忽略。

    提示npm版本小号更新。

  3. npm 版本更新

    1
    2
    3
    4
    5
    $ npm install -g npm@8.19.2

    added 1 package, and audited 212 packages in 8s

    found 0 vulnerabilities

  4. 检查,hexo

    1
    2
    3
    4
    5
    6
    7
    8
    9
    $ hexo version
    ========================================
    NexT version 8.13.0
    ========================================
    hexo: 6.3.0
    ...

    $ npm -v
    8.19.2

其它(全局) NodeJS 包版本检查

  1. npm outdated -g检查其它 Package 是否过期,更新

    1
    2
    3
    4
    5
    6
    $ npm outdated -g
    Package Current Wanted Latest Location Depended by
    webpack 5.73.0 5.74.0 5.74.0 node_modules/webpack global

    $ npm install webpack -g
    added 1 package, changed 76 packages, and audited 78 packages in 10s

  2. npm view webpack version检查,webpack 版本已更新:5.72.0 --> 5.73.0

    1
    2
    $ npm view webpack version
    5.74.0

    注:webpack 是一个现代 JavaScript 应用程序的静态模块打包器(module bundler).