安装 Node.js
使用 nvm 安装,Github 链接 。
最好装一个 Windows Terminal,安装完后输入 nvm version
查看是否安装成功。
安装 Node.js 并选择需要的版本。若报错,以管理员身份运行。
1 2 nvm install 16.15.0 nvm use 16.15.0
安装 Git
直接去 Git 官网 下载,全部默认安装就行。
安装 Hexo
查看是否安装成功
如果以下错误
1 2 3 4 5 6 7 hexo : 无法加载文件 C:\Program Files\nodejs\hexo.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.micros oft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。 所在位置 行:1 字符: 1 + hexo -v + ~~~~ + CategoryInfo : SecurityError: (:) [],PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess
执行
1 set-executionpolicy remotesigned
再查看版本即可
新建博客文件夹,切换到此路径,执行 Hexo 初始化。
本地运行,此时可以看见博客界面了
安装 Butterfly 主题
1 2 3 4 git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly npm install hexo-renderer-pug hexo-renderer-stylus --save
安装其他所需插件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 npm un hexo-renderer-marked --save npm un hexo-renderer-kramed --save npm install hexo-renderer-markdown-it --save npm install @neilsustc/markdown-it-katex --save npm install markdown-it-task-checkbox --save npm install hexo-wordcount --save npm install hexo-deployer-git --save npm install hexo-browsersync --save npm install hexo-abbrlink --save npm install hexo-generator-search --save
部署到 Github
若报以下错误,是因为没有配置 git。
1 2 3 4 5 6 7 8 9 10 11 Initialized empty Git repository in C:/Users/USER/Desktop/blog_source/.deploy_git/.git/ Author identity unknown *** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: unable to auto-detect email address (got 'USER@202-030.(none)')
执行
1 2 3 4 5 6 git config --global user.email "you@example.com" git config --global user.name "Your Name" git config --global user.email 10001@qq.com git config --global user.name xiaomage
再次执行 hexo d
时,会弹出 Github 登录窗口,登录即可部署。
将 rsa 添加到 Github