本地搭建hexo
1.安装node
1 2 3 4
| $ node -v v14.17.0 $ npm -v 7.20.0
|
2.安装git
省略
3.初始化hexo
进入想要部署hexo的目录,右键打开Git Bash here
1 2 3
| $npm install -g hexo
$ hexo init
|
版本查询
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| $ hexo -v INFO Validating config hexo: 5.4.0 hexo-cli: 4.3.0 os: win32 10.0.19043 node: 14.17.0 v8: 8.4.371.23-node.63 uv: 1.41.0 zlib: 1.2.11 brotli: 1.0.9 ares: 1.17.1 modules: 83 nghttp2: 1.42.0 napi: 8 llhttp: 2.1.3 openssl: 1.1.1k cldr: 38.1 icu: 68.2 tz: 2020d unicode: 13.0
|
4.开始进行基础操作
4.1创建一篇新的博客
1 2
| 完整格式 $ hexo new [layout] <title>
|
布局 |
路径 |
post (默认) |
source/_posts |
page |
source |
draft (草稿) |
source/_drafts |
注:1.可以通过 publish 命令将草稿移动到 source/_posts 文件夹。
2.自定义的其他布局和 post 相同,都将储存到 source/_posts 文件夹。
4.2清理内存,全局部署,启动服务
1
| hexo clean && hexo g && hexo s
|
现在端口是4000,修改到81
永久修改端口
进入目录:node_modules\hexo-server\index.js
1 2
| hexo.config.server = Object.assign({ port: 81,
|
临时修改端口
4.3浏览器查看
1 2 3
| http://127.0.0.1:81/ 或者 http://localhost:81
|
4.4使用md语法进行格式化文档
新手不会使用就直接大段文本来记录
以后会使用再进行格式化
4.5部署到服务器
5.遇到的错误
1.node版本过高
1 2 3 4 5 6 7
| (node:6172) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency (Use `node --trace-warnings ...` to show where the warning was created) (node:6172) Warning: Accessing non-existent property 'column' of module exports inside circular dependency (node:6172) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency (node:6172) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency (node:6172) Warning: Accessing non-existent property 'column' of module exports inside circular dependency (node:6172) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
|
2.下载资源失败
可能是网络原因,命令在重复输入