Build a Blog with Hexo and Github Pages (3)

Part 3: Errors when customizing the theme

Early this morning I was adding social links, google analytics and site map to my blog. After I edited the two config files, I made a hexo clean. Then I can’t generate the static web pages any more! There were only .md files and .styl files in the public folders without being converted to .html and .css files.

Then I spent the whole morning to solve this problem!

Soluntion 1

The first possible reason came from HuiHut’s blog. He suggested that this may be due to Hexo plugins missing.

Check the plugins:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ npm ls --depth 0
# Result below:
hexo-site@0.0.0 /Users/wang/Documents/blog
├── hexo@3.4.4
├── hexo-deployer-git@0.3.1
├── hexo-generator-archive@0.1.5
├── hexo-generator-category@0.1.3
├── hexo-generator-index@0.2.1
├── hexo-generator-sitemap@1.2.0
├── hexo-generator-tag@0.2.0
├── hexo-renderer-ejs@0.3.1
├── hexo-renderer-marked@0.3.2
├── hexo-renderer-stylus@0.3.3
└── hexo-server@0.2.2

Everything is all right.

Solution 2

Someone said wrong formats of .md in the ~/source/_posts/ may cause such errors. Then I deleted all .md files in this folder, but I still can’t generate any static files.

Solution 3

I convinced that errors must come from the config files. I edited the files again, but this time I can see the error messages in Terminal:

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
32
33
34
35
Unhandled rejection Error: ENOENT: no such file or directory, open '/Users/wang/Documents/blog/themes/next/layout/_scripts/schemes/.swig'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at Object.ret.load (/Users/wang/Documents/blog/node_modules/swig/lib/loaders/filesystem.js:55:15)
at exports.Swig.compileFile (/Users/wang/Documents/blog/node_modules/swig/lib/swig.js:695:31)
at Object.eval [as tpl] (eval at precompile (/Users/wang/Documents/blog/node_modules/swig/lib/swig.js:498:13), <anonymous>:369:18)
at compiled (/Users/wang/Documents/blog/node_modules/swig/lib/swig.js:619:18)
at Theme._View.View._compiled (/Users/wang/Documents/blog/node_modules/hexo/lib/theme/view.js:127:30)
at Theme._View.View.View.render (/Users/wang/Documents/blog/node_modules/hexo/lib/theme/view.js:29:15)
at /Users/wang/Documents/blog/node_modules/hexo/lib/hexo/index.js:390:25
at tryCatcher (/Users/wang/Documents/blog/node_modules/bluebird/js/release/util.js:16:23)
at /Users/wang/Documents/blog/node_modules/bluebird/js/release/method.js:15:34
at RouteStream._read (/Users/wang/Documents/blog/node_modules/hexo/lib/hexo/router.js:134:3)
at RouteStream.Readable.read (_stream_readable.js:442:10)
at resume_ (_stream_readable.js:822:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)

Unhandled rejection Error: ENOENT: no such file or directory, open '/Users/wang/Documents/blog/themes/next/layout/_scripts/schemes/.swig'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at Object.ret.load (/Users/wang/Documents/blog/node_modules/swig/lib/loaders/filesystem.js:55:15)
at exports.Swig.compileFile (/Users/wang/Documents/blog/node_modules/swig/lib/swig.js:695:31)
at Object.eval [as tpl] (eval at precompile (/Users/wang/Documents/blog/node_modules/swig/lib/swig.js:498:13), <anonymous>:369:18)
at compiled (/Users/wang/Documents/blog/node_modules/swig/lib/swig.js:619:18)
at Theme._View.View._compiled (/Users/wang/Documents/blog/node_modules/hexo/lib/theme/view.js:127:30)
at Theme._View.View.View.render (/Users/wang/Documents/blog/node_modules/hexo/lib/theme/view.js:29:15)
at /Users/wang/Documents/blog/node_modules/hexo/lib/hexo/index.js:390:25
at tryCatcher (/Users/wang/Documents/blog/node_modules/bluebird/js/release/util.js:16:23)
at /Users/wang/Documents/blog/node_modules/bluebird/js/release/method.js:15:34
at RouteStream._read (/Users/wang/Documents/blog/node_modules/hexo/lib/hexo/router.js:134:3)
at RouteStream.Readable.read (_stream_readable.js:442:10)
at resume_ (_stream_readable.js:822:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)

By googling, the messages mean hexo can’t find the theme. Then I went over my ~/theme/next/_config.yml for another time, and found all these were because of AN EXTRA SPACE! I deleted it, generated again, finally I can see all those static files in the public folder!

0%