astefanutti / decktape

PDF exporter for HTML presentations
MIT License
2.2k stars 177 forks source link

SyntaxError: Unexpected token '%' #88

Closed pat-s closed 7 years ago

pat-s commented 7 years ago

Getting the following error since a few days

SyntaxError: Unexpected token '%'

  phantomjs://code/decktape.js:1

Reinstallation solves it for one run, then the problem occurs again. I'm on macOS 10.12.3 using the Remark plugin

astefanutti commented 7 years ago

It looks like something touches the file(s) after installation. Can you look at the location pointed out by the error, that is first line of //code/decktape.js and check if there is a % character?

pat-s commented 7 years ago

Here are the first 20 lines of decktape.js

%PDF-1.4
1 0 obj
<<
/Title (þÿ)
/Creator (þÿ)
/Producer (þÿQt 5.6.0)
/CreationDate (D:20170313213955)
>>
endobj
2 0 obj
<<
/Type /Catalog
/Pages 3 0 R
>>
endobj
4 0 obj
<<
/Type /ExtGState
/SA true
/SM 0.02
astefanutti commented 7 years ago

It looks like a PDF file. So it seems like something overrides the decktape.js script with a PDF file. That explains why it works after install and then breaks.

pat-s commented 7 years ago

Yeah. So it seems that the output (when it works once) is not only written to the outcome pdf but also overrides decktape.js.

Its strange that this happened from one day to the other although I used decktape before dozen of times with the same call(s). Do you have an idea which application/lib could be involved here/is in charge of writing the pdf file?

astefanutti commented 7 years ago

How to you invoke DeckTape? What's your environment?

pat-s commented 7 years ago

Followed exactly your README. I'm on macOS 10.12.3 (Sierra)

astefanutti commented 7 years ago

Followed exactly your README

Which part? 😃 What exact command are you using the first time the decktape.js script gets overwritten?

I cannot think of any application / libs that could induce such a behaviour. I suspect the command you're running somehow resolves the PDF output positional argument as being the decktape.js first argument for some reasons...

pat-s commented 7 years ago

ah you mean the execution command:

~/tools/decktape-1.0.0/phantomjs ~/tools/decktape-1.0.0/decktape.js ~/Servers/GIServer/home/patrick/PhD/R/presentations/spring-school-R-intro/presentation/R-intro.html ~/tools/decktape-1.0.0/decktape.js ~/Servers/GIServer/home/patrick/PhD/R/presentations/spring-school-R-intro/presentation/R-intro.pdf

Ahh I just saw that (for whatever reason) ~/tools/decktape-1.0.0/decktape.js was inserted in the position of the output pdf argument (maybe some copy/pasting error) - so my fault and everything is fine.

Sorry for stealing your time :)

astefanutti commented 7 years ago

No worries, I'm glad we work this out!