Creating books with Gitbook

I’m currently tasked with the revision of some lecture material for basic HTML, CSS and PHP studies, so I thought I should give gitbook a try.

It’s a super sweet generator for creating an interactive website, a pdf and even epub from a loosely structured bunch of MarkDown files. You can imagine I love that.

Since I started playing with this locally, I didn’t have my content in a repository yet, but just in a folder and I simply didn’t get a hint in the usage instructions and got the following error:

Starting build ...
TypeError: Cannot call method 'replace' of undefined
 at Object.titleCase (/usr/lib/node_modules/gitbook/bin/utils.js:52:16)
 at /usr/lib/node_modules/gitbook/bin/build.js:36:44
 at _fulfilled (/usr/lib/node_modules/gitbook/node_modules/q/q.js:787:54)
 at self.promiseDispatch.done (/usr/lib/node_modules/gitbook/node_modules/q/q.js:816:30)
 at Promise.promise.promiseDispatch (/usr/lib/node_modules/gitbook/node_modules/q/q.js:749:13)
 at /usr/lib/node_modules/gitbook/node_modules/q/q.js:557:44
 at flush (/usr/lib/node_modules/gitbook/node_modules/q/q.js:108:17)
 at process._tickCallback (node.js:415:13)

Which was just me trying to write something else but the line below:

$ gitbook build -g jonathan/topic-book institution-webcourse/

After that everything worked fine. Since gitbook expects the source to be a repository it demands the author and title divided by the slash, like on github.

Leave a Reply

Your email address will not be published. Required fields are marked *