Hexo 完整使用教程

img

官网

官网地址:https://hexo.io/zh-cn/

环境

1.node

hexo 基于 node,所以首先要安装node环境

2.npm

包管理工具

环境配置请参考本站对应安装教程

快速开始

  1. 安装 hexo

    npm install -g hexo-cli
    
  2. 初始化 hexo

    hexo init
    
  3. 工程配置

    npm install
    
  4. 浏览器调试

    hexo g
    hexo s
    

主题安装

  1. 下载主题

    git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly
    
  2. 修改站点配置文件_config.yml,把主题修改为 Butterfly

    theme: Butterfly
    

    为便于后续平滑升级,在source目录下创建_data文件夹,将Themes/Butterfly目录下的 _config.yml复制一份到source/_data目录下,并改名为butterfly.yml

  3. 执行以下指令,以查看应用主题后的效果

    hexo clean #清除旧的内容
    hexo g #生成发布用的静态页面
    

错误处理

  • 错误1:如果第一次操作,可能会报以下的错误

    C: B1og)hexo g
    INFO Start processing
    FATAL Something s wrong. Maybe you can find the solution here: https:l /hexo. io/ docs/ troub1 eshooting. htm1
    Error: Cannot find module cheeri 0
    Require stack :
    C: B1 og themes But terflyscripts photo. js
    at Functi on. Module._ reso1veF ilename (internal / modul es/cjs/loader. js:797:15)
    at Functi on. Module._ load (internal 1 modul es/cjs/ loader. js:690:27)
    at Module. require (internal 1 modul es/c js/loader. js:852: 19)
    at require (C: B1og node_ modul es hexo)1ib hexolindex. js :280:23)
    at Hexo. (anonymous) (C: B1og themes Butterfly scripts photo. js:5: 19)
    at Hexo. tryCatcher (C: B1og node_ modul es b1uebirdljs release util. js:16:23)
    at Hexo. (anonymous) (C: B1og node_ modul es b1uebirdljs release method. js:15 :34)
    at C: B1 og node modul es hexo1ib extendlfilter. js:62:52
    at tryCatcher (C: B1og node_ modul es b1uebirdljs release util. js:16:23)
    at 0bject. gotValue (C: )B1og node_ modul es bluebird,js release reduce. js: 166:18)
    at 0bject. gotAccum (C: B1og node_ modul es b1uebird,js release reduce. js: 155:25 )
    at 0bject. tryCatcher (C: B1 og node_ modul es bluebirdljs releaseutil. js: 16:23)
    at Promise. sett1 ePromi seF romHandler (C: B1og node_ modul es b1uebirdjs rel ease promi se. js:547:31)
    at Promise. settlePromise (C: B1og node_ modul es bluebirdljs release promise. js :604: 18)
    at Promise. settlePromi se0 (C: B1og node_ modul es bluebird,js rel ease promise. js :649: 10)
    at Promise. settlePromises (C: B1og node_ modul es b1uebirdljs release promi se. js:729:18)
    at_ drainQueueStep (C: B1 og node_ modul es b1uebirdkjs release async. js:93:12)
    at drainQueue (C: B1og node_ modul es b1uebird,js release lasync. js:86:9)
    at Async._ drainQueues (C: )B1 og node_ modul es bluebirdljs re1 ease lasync. js: 102:5)
    at Immedi ate. Async. drainQueues [as onI mmediate] (C: B1og node_ modul es b1uebirdlisrelease)async. js:15:14)
    at processImmediate (internal/ timers. js: 439:21)
    
    • 解决方案
    npm install [email protected] --save
    hexo g
    hexo s
    
  • 错误2:如果你沒有 pug 以及 stylus 的渲染器会报错

    extends includes/layout.pug block content include ./includes/mixins/post-ui
    .pug #recent-posts.recent-posts +postUI include includes/pagination.pug
    
    • 解决方案
    npm install hexo-renderer-pug hexo-renderer-stylus --save
    npm install hexo-deployer-git --save / yarn add hexo-deployer-git
    
  • 再次依次执行

    hexo clean
    hexo g
    hexo s
    

完整博客

  • 超逸の博客 - 主题魔改+完整开源

    • 【源码开放】Hexo+Github 博客butterfly 和 matery 主题 搭建完全教程【整理】 | 超逸の博客
  • 小弋の生活馆 - 主题魔改

  • 洪卫の博客

    • 博客配置+网站优化:https://sunhwee.com/posts/6e8839eb.html

你可能感兴趣的:(Hexo 完整使用教程)