astefanutti / decktape

PDF exporter for HTML presentations
MIT License
2.19k stars 175 forks source link

AUR package #136

Closed pat-s closed 6 years ago

pat-s commented 6 years ago

Now available: https://aur.archlinux.org/packages/nodejs-decktape/

astefanutti commented 6 years ago

I've just added a link to the AUR package in the FAQ with c062d1f2405ee367d0439c791db6cfc86a7e6c91.

Let me know if you have any comment and thanks a lot for leading this!

pat-s commented 6 years ago

Thanks, I am about to test v2.8.3

After solving another nasty pupetteer one (https://github.com/GoogleChrome/puppeteer/issues/2519) I am stuck at what seems to be a decktape one (thats at least how it looks like in the first place)

decktape --no-sandbox  /home/pjs/Downloads/Remark.html test.pdf
Loading page file:///home/pjs/Downloads/Remark.html ...

Unable to load resource from URL: file:///home/pjs/Downloads/downloads/remark-latest.min.js
[object Object]

Unable to load resource from Udecktape --no-sandbox  /home/pjs/Downloads/Remark.html test.pdf
Loading page file:///home/pjs/Downloads/Remark.html ...

Unable to load resource from URL: file:///home/pjs/Downloads/downloads/remark-latest.min.js
[object Object]

Unable to load resource from URL: file:///home/pjs/Downloads/remark.language.js

Why is there an additional "downloads" inserted in the path which breaks the resource loading? Trying with the remark example presentation.

pat-s commented 6 years ago

@astefanutti any help would be appreciated, I am stuck here :open_mouth:

astefanutti commented 6 years ago

@pat-s sorry, I miss your comment. I haven't been able to reproduce locally. Could you double check that the links in the /home/pjs/Downloads/Remark.html file are actually correct and the presentation opens correctly. I cannot think of anything that could cause such a behaviour in Decktape :(

pat-s commented 6 years ago

@astefanutti Trying it again, I am now stuck at a way earlier stage: Due to the missing hummus binary for v10.2, hummus is build from source and throws an error..

https://gist.github.com/pat-s/a8d8e0095d386554a98009587e8a663a

Regarding your comment: I checked that everything was correct, I did not change anything in the default remark presentation. But for now the other error needs to be solved. Kinda tricky with all the nodejs updated on Arch.

astefanutti commented 6 years ago

Ah bummer 😞! I haven't tested Hummus binary compilation for Node 10.2. I'll give it a try ASAP and let you know.

pat-s commented 6 years ago

Interesting finds:

Could not relate the behavior to the commit history of package.json.

Also, running sudo npm -g install decktape works, doing it similar in the PKGBUILD ( npm install --user root -g --prefix "$pkgdir/usr" $_npmname@$pkgver) throws an error.

astefanutti commented 6 years ago

Interesting finds:

v.2.8.0 installs hummus 1.0.87 v.2.8.3 installs hummus 1.0.86 Could not relate the behavior to the commit history of package.json.

I changed the package-lock.json file for a npm-shrinkwrap.json file, as the later guarantees the same dependency versions are installed. That explains the versions you get for the Hummus dependency, and the decision to use a npm-shrinkwrap.json file.

Also, running sudo npm -g install decktape works, doing it similar in the PKGBUILD ( npm install --user root -g --prefix "$pkgdir/usr" $_npmname@$pkgver) throws an error.

What error does it throw?

pat-s commented 6 years ago

What error does it throw?

The error in the linked gist two comments above.

pat-s commented 6 years ago

Got it building again (v2.8.4), but executing fails due to the sandbox error. Even when using --no-sandbox.

I tried this but without success.

decktape --no-sandbox ~/Downloads/Remark.html ~/Downloads/remark.pdf 

Error: Failed to launch chrome!
[0605/105554.991958:ERROR:icu_util.cc(133)] Invalid file descriptor to ICU data received.
[0605/105554.992032:FATAL:content_main_delegate.cc(57)] Check failed: false. 
#0 0x55ae989f482c <unknown>
#1 0x55ae9897b290 <unknown>
#2 0x55ae96c2bde3 <unknown>
#3 0x55ae986aa941 <unknown>
#4 0x55ae986b4c12 <unknown>
#5 0x55ae986a9184 <unknown>
#6 0x55ae9c881a39 <unknown>
#7 0x55ae9c881ac2 <unknown>
#8 0x55ae986b1f8f <unknown>
#9 0x55ae96c2a1ac ChromeMain
#10 0x7fef76e6206b __libc_start_main
#11 0x55ae96c2a02a _start
astefanutti commented 6 years ago

Seems similar to GoogleChrome/puppeteer#2519 that you've already faced above.

pat-s commented 6 years ago

@astefanutti Next try ;)

Using decktape 2.8.5 I see:

decktape --no-sandbox Remark.html test.pdf

Loading page file:///home/pjs/git/pkgbuilds/nodejs-decktape/Remark.html ...

Unable to load resource from URL: file:///home/pjs/git/pkgbuilds/nodejs-decktape/downloads/remark-latest.min.js
Failed to load resource: net::ERR_FILE_NOT_FOUND

Unable to load resource from URL: file:///home/pjs/git/pkgbuilds/nodejs-decktape/remark.language.js
Failed to load resource: net::ERR_FILE_NOT_FOUND

Page error: ReferenceError: remark is not defined
    at file:///home/pjs/git/pkgbuilds/nodejs-decktape/Remark.html:464:18

Why is there a search going on in /home/pjs/git/pkgbuilds/nodejs-decktape/downloads/ (which does not even exist)? It seems decktape is trying to load the remark JS plugin but looks in the wrong place?

astefanutti commented 6 years ago

@pat-s looks like it's running!

It looks like the Remark.html file loads the Remark libs from the download directory. Could you double checked the script tags?

Alternatively, could you try testing directly the online presentation, e.g.:

$ decktape --no-sandbox http://remarkjs.com/ test.pdf
pat-s commented 6 years ago

Alternatively, could you try testing directly the online presentation,

That works!

But we need to resolve this local file issue.

Could you double checked the script tags?

What do you mean by this? I do not understand this :duck:

astefanutti commented 6 years ago

Could you double checked the script tags?

What do you mean by this? I do not understand this 🦆

I mean, inside the Remark.html file, what is the URL for the remark-latest.min.js resource? It seems Chrome is loading it from downloads/remark-latest.min.js so the only reason I see is that it's defined in the Remark.html file.

pat-s commented 6 years ago

Indeed, it is

<script src="downloads/remark-latest.min.js"></script>

Ok, so verifying that the online version works is enough then to verify a valid decktape build for me.

Then I can finally update the AUR package again. It has quite some warnings during packaging but as long as it works in the end ;)

astefanutti commented 6 years ago

Great! I agree packaging warning should not be a big deal.

pat-s commented 6 years ago

@astefanutti When building v2.8.9 I see the following:

Starting package()...
npm ERR! code ETARGET
npm ERR! notarget No matching version found for decktape@2.8.9
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pjs/.npm/_logs/2018-09-14T11_08_01_160Z-debug.log

detailed log: https://gist.github.com/pat-s/6b2af28e59ee49534ecc0de888843a14

astefanutti commented 6 years ago

@pat-s ah the NPM publish failed. I've just given another try so it should be fixed.

pat-s commented 6 years ago

Thanks, worked!