背景

主题更新了,顺手把框架也更新一下。

更新目标

  • npm: x.x.x

  • Hexo: x.x.x

  • Butterfly: x.x.x

  • Node: x.x.x

Node.js

Node.js — 下载 Node.js®

npm

npm 中文网

npm 最新国内镜像源设置 2025

1. 国内源

  • 淘宝:https://registry.npmmirror.com/
  • 腾讯云:https://mirrors.cloud.tencent.com/npm/
  • CNPM:https://r.cnpmjs.org/

2.设置

1
2
3
4
5
6
7
8
9
10
11
#查询当前使用的镜像源
npm get registry

#设置为淘宝镜像源
npm config set registry https://registry.npmmirror.com/

#验证设置
npm get registry

#还原为官方源
npm config set registry https://registry.npmjs.org/

3. 升级 nmp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 使用淘宝源的 cnpm 替换 npm
# npm install -g cnpm --registry=https://registry.npm.taobao.org
npm install -g cnpm --registry=https://registry.npmmirror.com/
cnpm install -g cnpm # 升级 npm
cnpm cache clean -f # 清除 npm 缓存

===更新 hexo: 进入 blog 目录,执行如下命令===
# 更新 package.json 中的 hexo 及个插件版本
cnpm install -g npm-check # 检查之前安装的插件,都有哪些是可以升级的
cnpm install -g npm-upgrade # 升级系统中的插件
npm-check
npm-upgrade

# 更新 hexo 及所有插件
cnpm update

# 确认 hexo 已经更新
hexo -v

HEXO框架更新

使用npm命令直接安装

您也可以使用npm命令直接安装指定版本。

1
npm install hexo@7.3.0 --save

1. 查看当前版本

定位到hexo博客根目录下, 运行 hexo -v,

2. 全局安装 hexo-cli

npm i hexo-cli -g

3. 安装 npm-check,若已安装可以跳过

npm install -g npm-check,

4. 检查系统插件是否需要升级

npm-check,

可以看到,所以依赖项最新版本都已列出,并且给出了升级命令。

5. 安装 npm-upgrade,若已安装可以跳过

npm install -g npm-upgrade

6. 查看可以更新 package.json插件

npm-upgrade,

所有升级项已列出,需要输入回车,最后一项 Update package.json 需要输入 yyes, 然后回车。 此时可以看到 package.json 里所有依赖项都已升级,但是 hexo 的版本还是 6.3.0

1
2
3
4
5
6
"hexo": {
"version": "6.3.0"
},
"dependencies": {
"hexo": "^7.0.0",
}

7. npm update --save,升级系统项

8. 查看package.json, hexo 的版本由 6.3.0 已变成 7.0.0

运行 hexo -v 再次查看:

9. npm update hexo-theme-butterfly --save, 升级主题,运行 hexo server,查看你的博客

升级完成,nice 😊

HEXO Butterfly主题及第三方插件更新

升級方法:在 Hexo 根目錄下,運行 npm update hexo-theme-butterfly

升级完成后记得参照对应版本的Butterfly主题更新_config.butterfly.yml文件

更新注意

HEXO框架及主题更新记录

更新记录

2025

10-23

版本更新:

  • Hexo: 7.3.0
  • Butterfly: 5.5.0
  • Node: v22.21.0
  • npm: 10.9.4

2022

10-01

版本更新:

  • Hexo: 6.3.0
  • Butterfly: 4.4.0
  • Node: v16.14.0
  • npm: 8.3.1

02-15

博客建站版本:

  • hexo: 6.0.0
  • Butterfly: 4.0.0
  • node: v16.14.0
  • npm: 8.3.1