GitbookIO / gitbook-convert

CLI to convert an existing document to a GitBook.
102 stars 19 forks source link

Minimum Node version #21

Open ywarnier opened 7 years ago

ywarnier commented 7 years ago

It would be nice to have some doc in the README (or in package.json) about the minimum Node version. Your log messages say you "Update to Node 6", but unless you put that in the README a normal user wouldn't find the information.

I use NodeJS v4.2.6 (default Ubuntu 16.10 package) and launching gitbook-convert -d doesn't return anything. Not in logs, not on the command line... In my opinion that could really be improved by adding a bit of messaging.

Note: I'm trying to use gitbook-convert from sources because I'm repeatedly failing to import this document: https://github.com/chamilo/docs/blob/1.11.x/en/admin/chamilo-1.11-guide-admin.odt to import on gitbook.com and I just receive a message saying the conversion failed, but I don't get any detail.

So I'm coming here to get more details, and then I'm stuck with no output either... :-)

Anyway, I couldn't say all that without congratulating you on gitbook.com. Really nice. Other .odt files have imported quickly and saved me a lot of time.

Oh, by the way, NodeJS 6 totally did the trick on Ubuntu Xenial.

ywarnier commented 7 years ago

I'm not sure if this is worth another issue because you're probably going to tell me that this is a sax issue or an odt2html issue (let me know), but I had similar issues with the document here: https://github.com/chamilo/docs/blob/1.11.x/fr/admin/chamilo-1.11-guide-administrateur.odt

[log]: "Creating export folder..."
[log]: "Creating assets folder..."
[log]: "Creating summary file..."
[log]: "Done."
[log]: "Converting odt file to HTML..."
[log]: "ERROR: Cannot read property 'replace' of undefined"
[log]: "ERROR: TypeError: Cannot read property 'replace' of undefined\n    at exports (/usr/local/lib/node_modules/gitbook-convert/node_modules/han/lib/make.js:7:16)\n    at Object.translate.letter (/usr/local/lib/node_modules/gitbook-convert/node_modules/han/lib/translate.js:35:5)\n    at pinyin (/usr/local/lib/node_modules/gitbook-convert/node_modules/normall/index.js:7:29)\n    at base (/usr/local/lib/node_modules/gitbook-convert/node_modules/normall/index.js:42:40)\n    at Function.filename (/usr/local/lib/node_modules/gitbook-convert/node_modules/normall/index.js:48:12)\n    at draw:image (/usr/local/lib/node_modules/gitbook-convert/node_modules/odt2html/lib/conversion.js:65:35)\n    at Object.saxParser.onopentag (/usr/local/lib/node_modules/gitbook-convert/node_modules/odt2html/lib/index.js:124:19)\n    at emit (/usr/local/lib/node_modules/gitbook-convert/node_modules/odt2html/node_modules/sax/lib/sax.js:640:35)\n    at emitNode (/usr/local/lib/node_modules/gitbook-convert/node_modules/odt2html/node_modules/sax/lib/sax.js:645:5)\n    at openTag (/usr/local/lib/node_modules/gitbook-convert/node_modules/odt2html/node_modules/sax/lib/sax.js:841:5)"

After many attempts at cleaning up the document, I found that removing completely illustrations 14 and 15 (start with 15), the document was parsed without issue. This seems completely incoherent with the error message (except a mention of "draw:image"), but there you go...

To find the issue (in an ODT file of about 100 pages), I first opened the file in LibreOffice, then used the following menu sequence (translated from French, so not sure the translation is perfect): File > Send > Create a master document, and created one with 1 level of elements. This generated one .odt file by chapter. From there, I tried several things, but removing all images worked, so I then started removing them one by one and launching gitbook-convert on each of these document, once after each image was deleted. This allowed me to pinpoint the image that was failing.