由於instantpage更新5.0.0,導致fancybox和簡繁轉換無法正常執行,需等待instantpage修復Bugs.目前可通過以下兩種方法解決

  1. 在設定中把instantpage設為false, 或者
  2. 在CDN中,把instantpage的js改為https://cdn.jsdelivr.net/npm/instant.page@3/instantpage.min.js

本教程更新於2020年05月20日
Butterfly已經升級到V2.3.5
為了方便我回復大家的問題和集中管理,此文章的評論關閉。
如有跟主題相關的問題,可以在Github Issues或者留言板上反饋/詢問

關於主題自定義的問題,建議仔細觀察主題代碼的寫法,自己動手操作,不懂的可以Google,我不一定會回答你的問題,請見諒。
你也可以加入討論群組
👉 QQ群 👉 Telegram群

Q & A

以下是一些網友在安裝的過程中出現的問題。在提問題之前,先看有沒有解決方法。

問題1 - 運行後網頁顯示代碼

頁面只顯示 extends includes/layout.pug block content #recent-posts.recent-posts include includes/recent-posts.pug include includes/pagination.pug #aside_content.aside_content include includes/aside.pug

請下載安裝:npm install hexo-renderer-pug hexo-renderer-stylus --save or `yarn add hexo-renderer-pug hexo-renderer-stylus

問題2 - 配置友情鏈接報錯

配置友情鏈接頁面時出現報錯

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
ERROR D:\Desktop\orxing-blog\themes\Butterfly\layout\flink.pug:2
1| .flink
> 2| each i in site.data.link
3| p.comment-word= i.class_name
4| .post-cards
5| ul.md-links

Cannot read property 'length' of undefined
TypeError: D:\Desktop\orxing-blog\themes\Butterfly\layout\flink.pug:2
1| .flink
> 2| each i in site.data.link
3| p.comment-word= i.class_name
4| .post-cards
5| ul.md-links

Cannot read property 'length' of undefined
at eval (eval at wrap (D:\Desktop\orxing-blog\node_modules\pug-runtime\wrap.js:6:10), <anonymous>:1890:32)
at eval (eval at wrap (D:\Desktop\orxing-blog\node_modules\pug-runtime\wrap.js:6:10), <anonymous>:2017:4)
at template (eval at wrap (D:\Desktop\orxing-blog\node_modules\pug-runtime\wrap.js:6:10), <anonymous>:10152:72)
at Theme._View.View._compiled (D:\Desktop\orxing-blog\node_modules\hexo\lib\theme\view.js:123:48)
at Theme._View.View.View.render (D:\Desktop\orxing-blog\node_modules\hexo\lib\theme\view.js:29:15)
at D:\Desktop\orxing-blog\node_modules\hexo\lib\hexo\index.js:349:21
at tryCatcher (D:\Desktop\orxing-blog\node_modules\bluebird\js\release\util.js:16:23)
at D:\Desktop\orxing-blog\node_modules\bluebird\js\release\method.js:15:34
at RouteStream._read (D:\Desktop\orxing-blog\node_modules\hexo\lib\hexo\router.js:123:3)
at RouteStream.Readable.read (_stream_readable.js:457:10)
at resume_ (_stream_readable.js:936:12)
at processTicksAndRejections (internal/process/task_queues.js:84:9)

請檢查 link.yml文檔內代碼的空格

問題3 - 升級最新版後運行報錯

升級最新版本hexo g後報錯

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
INFO  Deleted database.
INFO Start processing
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
TypeError: Cannot read property 'enable' of undefined
at Hexo.<anonymous> (/Users/qinkangdeid/Nextcloud/work/codes/personal/github/personal/qinkangdeid.github.io/themes/Butterfly/scripts/post-lazyload.js:5:23)
at Hexo.tryCatcher (/Users/qinkangdeid/Nextcloud/work/codes/personal/github/personal/qinkangdeid.github.io/node_modules/bluebird/js/release/util.js:16:23)
at Hexo.<anonymous> (/Users/qinkangdeid/Nextcloud/work/codes/personal/github/personal/qinkangdeid.github.io/node_modules/bluebird/js/release/method.js:15:34)
at /Users/qinkangdeid/Nextcloud/work/codes/personal/github/personal/qinkangdeid.github.io/node_modules/hexo/lib/extend/filter.js:60:50
at tryCatcher (/Users/qinkangdeid/Nextcloud/work/codes/personal/github/personal/qinkangdeid.github.io/node_modules/bluebird/js/release/util.js:16:23)
at Object.gotValue (/Users/qinkangdeid/Nextcloud/work/codes/personal/github/personal/qinkangdeid.github.io/node_modules/bluebird/js/release/reduce.js:155:18)
at Object.gotAccum (/Users/qinkangdeid/Nextcloud/work/codes/personal/github/personal/qinkangdeid.github.io/node_modules/bluebird/js/release/reduce.js:144:25)
at Object.tryCatcher (/Users/qinkangdeid/Nextcloud/work/codes/personal/github/personal/qinkangdeid.github.io/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/qinkangdeid/Nextcloud/work/codes/personal/github/personal/qinkangdeid.github.io/node_modules/bluebird/js/release/promise.js:517:31)
at Promise._settlePromise (/Users/qinkangdeid/Nextcloud/work/codes/personal/github/personal/qinkangdeid.github.io/node_modules/bluebird/js/release/promise.js:574:18)
at Promise._settlePromiseCtx (/Users/qinkangdeid/Nextcloud/work/codes/personal/github/personal/qinkangdeid.github.io/node_modules/bluebird/js/release/promise.js:611:10)
at _drainQueueStep (/Users/qinkangdeid/Nextcloud/work/codes/personal/github/personal/qinkangdeid.github.io/node_modules/bluebird/js/release/async.js:142:12)
at _drainQueue (/Users/qinkangdeid/Nextcloud/work/codes/personal/github/personal/qinkangdeid.github.io/node_modules/bluebird/js/release/async.js:131:9)
at Async._drainQueues (/Users/qinkangdeid/Nextcloud/work/codes/personal/github/personal/qinkangdeid.github.io/node_modules/bluebird/js/release/async.js:147:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/qinkangdeid/Nextcloud/work/codes/personal/github/personal/qinkangdeid.github.io/node_modules/bluebird/js/release/async.js:17:14)
at processImmediate (internal/timers.js:439:21)

請參照最新版的_config.xml, 比對後,把缺的配置複製到butterfly.xml去

問題4 - wordcount沒找到

報錯wordcount is not a function

請檢查是否安裝了wordcount插件 npm i --save hexo-wordcount

問題5 - 升級2.0.0後運行報錯

舊版本升級到2.0.0後報錯

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
INFO Start processing
FATAL Something’s wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Template render error: (unknown path)
unexpected end of file
at Object.prettifyError (F:\hexo\nodemodules\nunjucks\src\lib.js:36:11)
at Template.render (F:\hexo\node_modules\nunjucks\src\environment.js:542:21)
at Environment.renderString (F:\hexo\node_modules\nunjucks\src\environment.js:380:17)
at Promise.fromCallback.cb (F:\hexo\node_modules\hexo\lib\extend\tag.js:123:48)
at tryCatcher (F:\hexo\node_modules\bluebird\js\release\util.js:16:23)
at Function.Promise.fromNode.Promise.fromCallback (F:\hexo\node_modules\bluebird\js\release\promise.js:185:30)
at Tag.render (F:\hexo\node_modules\hexo\lib\extend\tag.js:123:18)
at Object.onRenderEnd (F:\hexo\node_modules\hexo\lib\hexo\post.js:280:20)
at Promise.then.then.result (F:\hexo\node_modules\hexo\lib\hexo\render.js:64:19)
at tryCatcher (F:\hexo\node_modules\bluebird\js\release\util.js:16:23)
at Promise.settlePromiseFromHandler (F:\hexo\nodemodules\bluebird\js\release\promise.js:517:31)

2.0.0版本以上刪掉了gallery,而引入新的gallery。所以如果有使用舊版,需刪掉或者更改寫法。

問題6 - 代碼渲染與實際不同

2.1.0 及一下版本會出現的問題

代碼渲染與實際不同

1
<div>aaa</div>

渲染結果:

cheerio版本錯誤,請安裝0.22.0版本

npm install cheerio@0.22.0 –save

問題7 - 搜索欄在底部

hexo deploy後搜索欄在頁面底部

生成前先hexo clean

打賞

非常感謝以下網友的打賞

Wechat

名字金額
B*X2.33
A*.0.01
*虎3
*、5
*林3.75
*雪10
O*r15
*泥0.01
*嗎5
*鋒10
*強5
K*n6.66
*12.22
圖*_5
B*e6.66
n*l6.66
*仔5
M*52
w*r18.88
*龍1.60
*一5

Alipay

名字金額
iMIGw010
百事可樂10
KT5
JVxie8.88
Coolkk10
Sirius10
惴繞1.11
Jiang慢慢8.88