Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility issue with latest reveal.js release (script error)? #1003

Closed
HP-Nunes opened this issue Apr 30, 2019 · 3 comments
Closed

Compatibility issue with latest reveal.js release (script error)? #1003

HP-Nunes opened this issue Apr 30, 2019 · 3 comments

Comments

@HP-Nunes
Copy link

I'm trying to publish a set of converted slides using GitHub Pages and deploying via TravisCI, and I've been successful in the past doing so, this is how I'm deploying on TravisCI:

install:
    - pip install jupyter
    - wget https://github.com/hakimel/reveal.js/archive/master.zip
    - unzip master.zip
    - mv reveal.js-master reveal.js

script:
    - jupyter nbconvert nb.ipynb --to slides --reveal-prefix=reveal.js

after_success: |
    if [ -n "$GITHUB_API_KEY" ]; then
    git checkout --orphan gh-pages
    git rm -rf --cached .
    mv nb.slides.html index.html
    git add -f --ignore-errors index.html img reveal.js
    git -c user.name='travis' -c user.email='travis' commit -m init
    git push -f -q https://$GITHUB_USER:$GITHUB_API_KEY@github.com/$TRAVIS_REPO_SLUG gh-pages
    fi

However over the last 10 days the slides won't load and I keep getting the following recurring issues during deployment:

Failed to load resource: the server responded with a status of 404 ()  
/deploy/custom.css:1 

Uncaught Error: Load timeout for modules: reveal.js/lib/js/head.min.js,reveal.js/js/reveal.js
http://requirejs.org/docs/errors.html#timeout
    at C (require.min.js:8)
    at D (require.min.js:13)
    at require.min.js:14

Failed to load resource: the server responded with a status of 404 ()
head.min.js:1

require.min.js:8 Uncaught Error: Script error for: reveal.js/lib/js/head.min.js
http://requirejs.org/docs/errors.html#scripterror
    at C (require.min.js:8)
    at HTMLScriptElement.onScriptError (require.min.js:29)

I am still able to deploy the slides locally, and they look as they should:
jupyter nbconvert *.ipynb --to slides --post serve

According to Hakim, head.min.js was removed from the latest reveal.js release. But I noticed that head.min.js is inserted into the html files of both the converted notebook slides and the index of the reveal.js submodule. Thus are the script errors the result of compatibility between reveal.js and nbconverter? What can I do to deploy the slides normally?

@MSeal
Copy link
Contributor

MSeal commented Apr 30, 2019

From what I can read in the template code (not very familiar with the slides exporter) the code is expecting to run against ~3.5.0 and hasn't been tested for 3.8.0+:
https://github.com/jupyter/nbconvert/blob/master/nbconvert/exporters/slides.py#L103
and injects the dependency here (which was written 4 years ago and not touch since):
https://github.com/jupyter/nbconvert/blame/master/nbconvert/templates/html/slides_reveal.tpl#L229

Ideally we should change the script to conditionally add that dependency depending on if if the reveal version is < 3.8. But in your case you're pulling master (not versioned / tested code) and expecting it to work with nbconvert which has not been tested with that code commit.

I would pin reveal to <=3.7, or try pinning nbconvert back to 5.4 (not sure if the latter will solve anything).

To pin reveal you can either remove the custom download and assignment of --reveal-prefix=reveal.js, which will switch to using 3.5. Or you can change the js download to be specific to a particular version by changing the wget call to wget https://github.com/hakimel/reveal.js/archive/3.7.0.zip.

To pin nbconvert you can add pip install nbconvert==5.4.1 to your install section before the jupyter install.

@HP-Nunes
Copy link
Author

Hi Matthew,

thank you for your reply. Removing --reveal-prefix=reveal.js from my .yml configuration file has enabled deployment once again. I had tried using different deployments of reveal.js but the script would fail on TravisCI as it wouldn't unzip the file (?).

Thanks again!

@shawngiese
Copy link

shawngiese commented Aug 26, 2019

You could also make a new slides_reveal_3.8.tpl and use that when generating slides. Inside the new template you can remove the old dependencies. You can also overwrite the old prefix with a newer version up to 3.7... --reveal-prefix "https://cdn.jsdelivr.net/npm/reveal.js@3.7.0"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants