2025重回hexo

rayepeng Lv2

白鹭捕食

—— 图片是白鹭在捕食

hexo报错记录排查

安装主题 hexo-theme-tranquilpeak/DOCUMENTATION.md at main · LouisBarranqueiro/hexo-theme-tranquilpeak

步骤如下:

  1. 下载主题代码包,放入到hexo主题themes文件夹下,解压,修改名字为 tranquilpeak
  2. 修改根目录下的 _config.yml 文件 theme 字段
  3. 接着又进入到hexo themes/tranquilpeak目录下,运行 npm install && npm run prod 这一步遇到了报错,这里首先解决 npm install的报错

首先是安装依赖的报错,会提示没有python,那么就安装python,因为需要用到本地编译一个包

接着又开始报错,报错信息贴在下面,AI告诉我是node-sass已经不用了,直接换成sass就好

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
npm warn deprecated debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm warn deprecated @npmcli/fs@1.1.0: this version had an improper engines field added, update to 1.1.1
npm warn deprecated axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
npm warn deprecated core-js@1.2.7: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm error code 1
npm error path D:\workspace\myblog\themes\tranquilpeak\node_modules\node-sass
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
npm error Building: C:\Program Files\nodejs\node.exe D:\workspace\myblog\themes\tranquilpeak\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm error gyp info it worked if it ends with ok
npm error gyp verb cli [
npm error gyp verb cli 'C:\\Program Files\\nodejs\\node.exe',
npm error gyp verb cli 'D:\\workspace\\myblog\\themes\\tranquilpeak\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm error gyp verb cli 'rebuild',
npm error gyp verb cli '--verbose',
npm error gyp verb cli '--libsass_ext=',
npm error gyp verb cli '--libsass_cflags=',
npm error gyp verb cli '--libsass_ldflags=',
npm error gyp verb cli '--libsass_library='
npm error gyp verb cli ]
npm error gyp info using node-gyp@8.4.1
npm error gyp info using node@24.3.0 | win32 | x64
npm error gyp verb command rebuild []
npm error gyp verb command clean []

安装sass,安装依赖成功了

1
npm i sass@latest

npm run prod 报错,这里是因为我已经修改了依赖,这时候就需要修改 "themes\tranquilpeak\tasks\config\sass.js" 这个文件,将其 require 的依赖给修改为 sass

至此,这个主题终于安装成功了

hexo写作——typora如何配置自动化压缩并上传图片至腾讯云cos

目前采用的是typora写作 + picgo自动上传图片 + 坚果云同步的方式,因为坚果云使用的是免费的1G流量上传,所以不能把图片存在本地,这里聊一下如何解决写作的时候图片存储问题

最好的方式就是用CDN,直接腾讯云买一个也不贵,然后使用picgo工具来实现图片上传,这个工具分为命令行和GUI客户端,我最开始用的是GUI客户端,每次复制图片然后快捷键调用一下就能自动复制出markdown的图片插入文本,非常方便

但还有更方便的,即使用typora+picgo命令行实现自动上传,配置方式如下:

需要注意的是,typora会自动下载一个picgo的命令行程序版本,这个和 npm install -g picgo 不是同一个,比如我这里typora自动下载的命令行程序就位于

1
C:\\Users\\Admin\\AppData\\Roaming\\Typora\\picgo\\win64\\picgo.exe

这样我后续要安装插件,比如图片压缩插件,ref:juzisang/picgo-plugin-compress: Image compression plugin for PicGo

这时候我就需要执行,这样就安装好插件了(对的我就是因为没搞清楚GUI客户端怎么安装插件所以才选择了命令行,不过这样也有一个好处,就是可以默认图片是压缩的,如果需要上传原图,那么就用picgo客户端即可)

1
2
3
C:\\Users\\Admin\\AppData\\Roaming\\Typora\\picgo\\win64\\picgo.exe add compress
C:\\Users\\Admin\\AppData\\Roaming\\Typora\\picgo\\win64\\picgo.exe use transformer
C:\\Users\\Admin\\AppData\\Roaming\\Typora\\picgo\\win64\\picgo.exe config plugin compress

image-20250706140144197

配置好之后,选择验证图片上传选项,可以看到整个的执行过程会以日志的形式打出来

image-20250706140434549

  • Title: 2025重回hexo
  • Author: rayepeng
  • Created at : 2025-07-06 11:12:10
  • Updated at : 2025-07-07 22:22:57
  • Link: https://raye.ink/2025/07/06/2025重回hexo/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments