scottsteinbeck / commandbox-gitbook

A CommandBox module for converting a Gitbook into an eBook
25 stars 3 forks source link

Command "gitbook" cannot be resolved | Module [gitbook-exporter] failed to load! #32

Closed DesertCookie closed 4 years ago

DesertCookie commented 4 years ago

Trying to install gitbook from within CommandBox gave the following error:

CommandBox> install gitbook-exporter
 √ | Installing package [forgebox:gitbook-exporter]

Module [gitbook-exporter] failed to load!  Check the logs for more info ( system-log | open ).
>    Missing [;] or [line feed] after expression
>    C:\Users\User\.CommandBox\cfml\modules\gitbook-exporter\models\ExportService.cfc:164

The same gets displayed trying to install/run gitbook from cmd with box gitbook ....

I am running Windows 10, OpenJDK 13, CommandBox 4.8.0, gitbook-exporter 1.0.2 (at least I tried :P ).

bdw429s commented 4 years ago

Hi @DesertCookie it looks like you did everything right. I can't reproduce this error on my Windows 10 machine and that line of code looks fine:

https://github.com/scottsteinbeck/commandbox-gitbook/blob/master/models/ExportService.cfc#L164

Can you please give this a go on Java 8? If you don't want to change the main version of Java on your PC, use the "JRE included" download of CommandBox which has a JRE folder that you keep in the same directory as box.exe and it contains a copy of the Java 8 JRE. We have suppport for Java 9+ coming, but have been held up due to some bugs in a library that doesn't support Java 8. I'm curious if it's related to the parsing issues.

DesertCookie commented 4 years ago

I tried using the version that includes the Java 8 distribution, going as far as to set it in the registry (PATH still points to J13 - hope that's not a problem, as the doc states Box looks at the registry). Also, for me, line 164 is line 191 in the online version of ExportService.cfc.

Here's the commandbox.log if needed - holy hell, what a mess.

bdw429s commented 4 years ago

@DesertCookie Sorry, I missed your reply somehow. That line number makes a lot more sense. I'm guessing you have a slightly old version of the module. You can update it with

update --system

However, I don't think that will help your error. Now with the correct line number, I can tell the PDF Extension failed to load. I've seen this before but I've never been able to reproduce it myself and it seems to happen sometimes on computers that are heavily locked down or have anti virus.

First, you can try to delete your ~/.CommandBox directory and then run box again for a clean unpacking to see if it helps.

DesertCookie commented 4 years ago

That did the trick. Thank you.

Edit: I have a revision.json missing. Cannot find resources right now telling me how to generate one or in what format it should be. Could you point me in the right direction?

bdw429s commented 4 years ago

@DesertCookie Can you explain? So far as I know, all Gitbook exports contain a revision.json file. Or at least I've never seen an export that didn't contain one. I'm not affiliated with Gitbook myself so if you exported a book and the zip file doesn't contain a revision.json file, then I'd perhaps log a support ticket with them.

Chances are, you are simply running the command from the wrong folder. Unzip the zip export, cd into that directory and test you are in the correct place by running gitbook toc. Verify that your current directory has the space.json and revisions.json file.

DesertCookie commented 4 years ago

Well, I created my GitBook's root using the old CLI. It din't generate a revision.json. Will try to import my project as a GitBook and then export it to get the files.

bdw429s commented 4 years ago

@DesertCookie You can access the export feature from the Gitbook website as explained here:

https://github.com/scottsteinbeck/commandbox-gitbook#acquire-your-book-export

The PDF generator must be run from the root folder of what you get when you unzip that export.

DesertCookie commented 4 years ago

Everything is working now. Thanks for the great support. Thanks for the great tool.
Are you working on improving how certain features translate into PDF/HTML? Namely tabs and code blocks (withing tabs). They are quite unreadable currently.

bdw429s commented 4 years ago

@DesertCookie Thanks, I'm going to close this ticket now since you're up and running. Please create some new tickets for anything we can improve and include a reference to the original book as well as some screenshots of what you're seeing and we'll see what we can do to improve!