hexo主题切换可能出现的错误
1.1上传时出现error:spawn failed...问题
方法一
git bash 进入博客根目录
rm -rf .deploy_git/ //删除提交内容文件夹
git config --global core.autocrlf false //执行
hexo clean
hexo g
hexo d
方法二
修改 _config.yml 文件,将配置地址http方式切换成ssh方式
git bash 进入博客根目录
vim _config.yml //删除git提交内容文件夹
修改最后一行内容
deploy:
type:git
repository:git@github.com:Uninfo/github用户名.github用户名.io.git
branch:master
hexo clean
hexo g
hexo d
1.2运行后博客页面为{% extends ‘layout.swig‘ %} {% import ‘macro/post.swig‘ as post_template %}问题
原因是hexo5.0后swig被删除,需自己手动安装
npm i hexo-renderer-swig
1.3绑定域名失效
方法一:
只要在source 目录添加一个新文件CNAME就好
CNAME –不带任何后缀,内容为域名
方法二:
安装插件
npm install hexo-generator-cname --save
之后在_config.yml中添加一条
Plugins:
hexo-generator-cname 当第一个方法不能用时,应该是把方法二里面的插件也安装啦,两个有冲突,只需要执行
npm uninstall hexo-generator-cname --save