0%

我的第一篇文章

一、博客安装笔记(部署在Github)
  1. #安装Node.js,直接去官网下载最新版:nodejs.org
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
node -v	#查看node版本

npm -v #查看npm版本

npm install -g cnpm --registry=http://registry.npm.taobao.org #安装淘宝的cnpm 管理器

cnpm -v #查看cnpm版本

cnpm install -g hexo-cli #安装hexo框架

hexo -v #查看hexo版本

mkdir blog #创建blog目录

cd blog #进入blog目录

hexo init #生成博客 初始化博客

hexo init如果报错

1
2
3
error: RPC failed; curl 28 Recv failure: Connection was reset

fatal: expected flush after ref listing

先输入:

1
git config --global http.sslVerify "false"
1
hexo s	#启动本地博客服务

http://localhost:4000/ #本地访问地址

1
2
3
4
5
6
7
8
9
10
11
hexo n "我的第一篇文章" #创建新的文章 

#返回blog目录

hexo clean #清理

hexo g #生成

#Github创建一个新的仓库 YourGithubName.github.io

cnpm install --save hexo-deployer-git #在blog目录下安装git部署插件

  1. #配置_config.yml
1
2
3
4
5
6
7
8
9
10
11
# Deployment

## Docs: https://hexo.io/docs/deployment.html

deploy:

type: 'git'

repo: https://github.com/Jenny-ju/Jenny-ju.github.io.git

branch: master

  1. #重新清理、生成、部署到仓库
1
2
3
4
5
hexo clean  # 这个一定要有,否则会404,打不开网页

hexo g #生成

hexo d #部署到Github仓库里

  1. #访问这个地址可以查看博客

https://jenny-ju.github.io/ #查看博客


  1. #更改主题
1
2
3
4
5
6
7
8
9
 git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia  #下载yilia主题到本地

\#修改hexo根目录下的 _config.yml 文件 : theme: yilia

hexo clean #清理一下(注意:windows下不能缩写)

hexo g #生成

hexo d #部署到远程Github仓库

https://jenny-ju.github.io/ #查看博客


  1. 报错:Spawn failed
1
2
3
4
5
6
7
8
9
# 报错内容:
Please make sure you have the correct access rights
and the repository exists.
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Error: Spawn failed
at ChildProcess.<anonymous> (E:\Projects\blog\node_modules\.store\hexo-util@2.7.0\node_modules\hexo-util\lib\spawn.js:51:21)
at ChildProcess.emit (node:events:514:28)
at cp.emit (E:\Projects\blog\node_modules\.store\cross-spawn@7.0.3\node_modules\cross-spawn\lib\enoent.js:34:29)
at ChildProcess._handle.onexit (node:internal/child_process:294:12)
1
2
3
4
# 报错原因:代码提交到GitHub上出错,需要输入GitHub账户默认标识
# 解决方法:输入以下两行代码
git config --global user.email "21981682202@qq.com"
git config --global user.name "Jenny-ju"

  1. hexo无法显示图片的问题,按照下面方法还是未解决

hexo无法显示本地图片的问题_hexo 图片无法加载-CSDN博客

二、博客安装笔记(部署在Gitee)
  1. 配置SSH免密登录

Hexo博客搭建和使用教程(Windows)_hexo安装-CSDN博客

  1. 解决Gitee网站404问题:要开启GiteePages功能

hexo+gitee(码云)搭建个人博客避开所有坑-CSDN博客

  1. 其他步骤和Github一样
三、样式修改next

Hexo-Next 主题博客个性化配置超详细,超全面(两万字)_hexo next 记录访问了ip-CSDN博客

Hexo 添加分类及标签-CSDN博客