title: blog
date: 2024-08-14 11:24:35
categories:
- Hexo
- blog
- 教程
tags:
- Hexo
- 教程
keywords: “blog,Hexo,github”
cover: https://s2.loli.net/2024/08/14/xCVrUGEQ1WhSpPs.png
访问个人blog查看详情 https://caokaier.zeabur.app/
可以使用hexo+github pages直接搭建,这里使用zeabur设置域名访问
安装git、node.js(这里不过多赘述)
Hexo文档以及主题 https://hexo.io/zh-cn/ 注意官方文档很久没更新了
#验证Node.js、npm、git是否正常安装
node -v
npm -v
git -v
#安装Hexo
npm install -g hexo-cli #国内安装较慢
#修改为使用阿里云镜像源安装
访问 https://npmmirror.com/ 复制代码 即:
npm install -g cnpm --registry=https://registry.npmmirror.com #这个过程可能相对较慢,耐心等待,安装后把npm换成cnpm使用
#安装Hexo
cnpm install -g hexo-cli
#初始化Hexo项目
hexo init blogfile #在选定位置执行,会生成blogfile文件项目,拉取可能失败,多执行几次即可
#也可以新建好blogfile文件夹,进入后直接执行 hexo init 尝试几次发现这样拉取成功几率大
#我这里出现了一下错误,没有错误的可以忽略直接 hexo g 并启动服务 hexo s 这里 hexo init 时下载依赖失败 手动下载
#一下是全部过程,耐心查看
beast@gentle-beast MINGW64 /d
$ hexo init blogfile
INFO Cloning hexo-starter https://github.com/hexojs/hexo-starter.git
INFO Install dependencies
warning hexo > warehouse > cuid@2.1.8: Cuid and other k-sortable and non-cryptog
raphic ids (Ulid, ObjectId, KSUID, all UUIDs) are all insecure. Use @paralleldri
ve/cuid2 instead.
warning hexo-renderer-marked > jsdom > abab@2.0.6: Use your platform's native at
ob() and btoa() methods instead
warning hexo-renderer-marked > jsdom > data-urls > abab@2.0.6: Use your platform
's native atob() and btoa() methods instead
warning hexo-renderer-marked > jsdom > domexception@4.0.0: Use your platform's n
ative DOMException instead
warning hexo-renderer-stylus > stylus > glob@7.2.3: Glob versions prior to v9 ar
e no longer supported
warning hexo-renderer-stylus > stylus > glob > inflight@1.0.6: This module is no
t supported, and leaks memory. Do not use it. Check out lru-cache if you want a
good and tested way to coalesce async requests by a key value, which is much mor
e comprehensive and powerful.
WARN Failed to install dependencies. Please run 'npm install' in "D:\blogfile"
folder.
#这里报错依赖
beast@gentle-beast MINGW64 /d
$ cd blogfile/
beast@gentle-beast MINGW64 /d/blogfile
$ ls
_config.landscape.yml node_modules/ scaffolds/ themes/
_config.yml package.json source/
#使用cnpm手动安装
beast@gentle-beast MINGW64 /d/blogfile
$ cnpm install
√ Installed 10 packages on D:\blogfile
√ All packages installed (used 36ms(network 27ms), speed 0B/s, json 0(0B), tarba
ll 0B, manifests cache hit 0, etag hit 0 / miss 0)
#生成静态文件又报错,报错显示highlight.js 模块可能中出现了语法错误
beast@gentle-beast MINGW64 /d/blogfile
$ hexo g
INFO Validating config
INFO Start processing
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/d
ocs/troubleshooting.html
D:\blogfile\node_modules\highlight.js\lib\languages\isbl.js:1806
// enum TE
SyntaxError: Unexpected end of input
at wrapSafe (node:internal/modules/cjs/loader:1281:20)
at Module._compile (node:internal/modules/cjs/loader:1321:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node: