ERROR: Failed to set up Chromium r768783! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
michelefioretti opened this issue · comments
Hello,
I'm trying to set up decktape
by running
sudo npm install -g decktape
I get the following error
Password:
/usr/local/bin/decktape -> /usr/local/lib/node_modules/decktape/decktape.js
> puppeteer@5.1.0 install /usr/local/lib/node_modules/decktape/node_modules/puppeteer
> node install.js
ERROR: Failed to set up Chromium r768783! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
[Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/decktape/node_modules/puppeteer/.local-chromium'] {
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/usr/local/lib/node_modules/decktape/node_modules/puppeteer/.local-chromium'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer@5.1.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer@5.1.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/michelefioretti/.npm/_logs/2020-08-24T16_26_42_443Z-debug.log
Any idea on how to solve this issue? Thank you so much.
It seems like a possible error when installing Puppeteer globally: https://github.com/puppeteer/puppeteer/search?q=Error%3A+EACCES%3A+permission+denied%2C+mkdir+%2Fusr%2Flocal%2Flib%2Fnode_modules&unscoped_q=Error%3A+EACCES%3A+permission+denied%2C+mkdir+%2Fusr%2Flocal%2Flib%2Fnode_modules&type=Issues.
You may want to try some of the solutions from https://stackoverflow.com/questions/48869749/npm-install-puppeteer-showing-permission-denied-errors.
Let me know if one of them works for you. That may be useful info to add to the troubleshooting documentation.
Thank you for the quick reply. I followed the stackoverflow suggestions but it still doesn't work
Last login: Mon Aug 24 20:07:45 on ttys000
Michele:~ michelefioretti$ node -v
v14.8.0
Michele:~ michelefioretti$ sudo apt update
Password:
Sorry, try again.
Password:
Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/apt" (-1)
Michele:~ michelefioretti$ sudo npm install puppeteer --unsafe-perm=true --allow-root
> puppeteer@5.2.1 install /Users/michelefioretti/node_modules/puppeteer
> node install.js
Downloading Chromium r782078 - 128 Mb [====================] 100% 0.0s
Chromium (782078) downloaded to /Users/michelefioretti/node_modules/puppeteer/.local-chromium/mac-782078
npm WARN michelefioretti@1.0.0 No description
npm WARN michelefioretti@1.0.0 No repository field.
+ puppeteer@5.2.1
updated 1 package and audited 127 packages in 154.28s
5 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Michele:~ michelefioretti$ sudo npm install -g decktape
/usr/local/bin/decktape -> /usr/local/lib/node_modules/decktape/decktape.js
> puppeteer@5.1.0 install /usr/local/lib/node_modules/decktape/node_modules/puppeteer
> node install.js
ERROR: Failed to set up Chromium r768783! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
[Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/decktape/node_modules/puppeteer/.local-chromium'] {
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/usr/local/lib/node_modules/decktape/node_modules/puppeteer/.local-chromium'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer@5.1.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer@5.1.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/michelefioretti/.npm/_logs/2020-08-24T18_15_36_353Z-debug.log
The same error as before, but puppeteer
seems installed correctly. I'm sorry, I'm not familiar with puppeteer
, do yo have any other suggestion? Thank you
Puppeteer installs correctly with:
$ sudo npm install puppeteer --unsafe-perm=true --allow-root
because it is installed locally.
Could you try with the -g
option, e.g.:
$ sudo npm install -g puppeteer --unsafe-perm=true --allow-root
Also, could you try to apply the work-around to Decktape install, e.g.:
$ sudo npm install -g decktape --unsafe-perm=true --allow-root
It worked (probably)! Here is the output:
Michele:~ michelefioretti$ sudo npm install -g puppeteer --unsafe-perm=true --allow-root
Password:
Sorry, try again.
Password:
> puppeteer@5.2.1 install /usr/local/lib/node_modules/puppeteer
> node install.js
Downloading Chromium r782078 - 128 Mb [====================] 100% 0.0s
Chromium (782078) downloaded to /usr/local/lib/node_modules/puppeteer/.local-chromium/mac-782078
+ puppeteer@5.2.1
updated 1 package in 145.196s
Michele:~ michelefioretti$ sudo npm install -g decktape --unsafe-perm=true --allow-root
/usr/local/bin/decktape -> /usr/local/lib/node_modules/decktape/decktape.js
> puppeteer@5.1.0 install /usr/local/lib/node_modules/decktape/node_modules/puppeteer
> node install.js
Downloading Chromium r768783 - 125.1 Mb [====================] 100% 0.0s
Chromium (768783) downloaded to /usr/local/lib/node_modules/decktape/node_modules/puppeteer/.local-chromium/mac-768783
+ decktape@3.1.0
added 73 packages from 115 contributors in 141.047s
Michele:~ michelefioretti$ decktape
url argument is required
Usage: decktape [options] [command] <url> <filename>
decktape version
command one of: automatic, bespoke, deck, dzslides, flowtime, generic, impress, inspire, nuedeck, remark, reveal, rise, shower-1.x, shower-2.x, slidy, webslides
url URL of the slides deck
filename Filename of the output PDF file
Options:
-s <size>, --size <size> Size of the slides deck viewport: <width>x<height> (e.g. '1280x720')
-p <ms>, --pause <ms> Duration in milliseconds before each slide is exported [1000]
--load-pause <ms> Duration in milliseconds between the page has loaded and starting to export slides [0]
--screenshots Capture each slide as an image [false]
--screenshots-directory <dir> Screenshots output directory [screenshots]
--screenshots-size <size> Screenshots resolution, can be repeated
--screenshots-format <format> Screenshots image format, one of [jpg, png] [png]
--slides <range> Range of slides to be exported, a combination of slide indexes and ranges (e.g. '1-3,5,8')
--chrome-path <path> Path to the Chromium or Chrome executable to run instead of the bundled Chromium
--chrome-arg <arg> Additional argument to pass to the Chrome instance, can be repeated
Defaults to the automatic command.
Iterates over the available plugins, picks the compatible one for presentation at the
specified <url> and uses it to export and write the PDF into the specified <filename>.
Am I supposed to run decktape
after the sudo npm install -g decktape --unsafe-perm=true --allow-root
command? Thanks a lot!
Yes, it seems it worked. You should be able to run decktape
fine.
But doesn't the line url argument is required
indicate an error? Thanks
No, that means you have to provide the URL for the presentation you want to export, e.g.:
$ decktape https://revealjs.com/demos/3.9.2 slides.pdf
My goal was to use it in R markdown. So at the end of the markdown file I include:
|||{r makepdf, echo=FALSE,eval=FALSE}
system("decktape chapter1.html chapter1.pdf --chrome-arg=--disable-web-security")
|||
(where I substituted ||| for the three apostrophes to show you the whole code) but it doesn't run (and it gives no error). I also tried giving it the full path to file after "decktape ..." but it didn't work. If instead I run it from terminal I get
Michele:~ michelefioretti$ decktape https://github.com/michelefioretti/ScPoEconometrics-Slides/blob/master/chapter1/chapter1.html chapter1.pdf
Loading page https://github.com/michelefioretti/ScPoEconometrics-Slides/blob/master/chapter1/chapter1.html ...
Loading page finished with status: 200
No supported DeckTape plugin detected, falling back to generic plugin
Generic plugin activated
Printing slide #562 (562/ ?) ...
and keeps on running forever (the number of slides is 36 -- 67 if we consider that bullet points appear sequentially, creating multiple slides per page). Thank you!
It does not work, because with:
$ decktape https://github.com/michelefioretti/ScPoEconometrics-Slides/blob/master/chapter1/chapter1.html chapter1.pdf
You provide the https://github.com/michelefioretti/ScPoEconometrics-Slides/blob/master/chapter1/chapter1.html
, but it is not a valid presentation. It is a GitHub page.
You have to provide your presentation that is served by a Web server (or from the file system), e.g.:
$ decktape https://raw.githack.com/michelefioretti/ScPoEconometrics-Slides/master/chapter1/chapter1.html chapter1.pdf --chrome-arg=--disable-web-security
Now it works great! Thank you! Final question: any idea why it doesn't work on markdown? I provide it with the raw html file ("chapter1.html"), so it should work
What command did you use to export chapter1.html
? Also what error did you get?
The header of the Markdown file is:
---
title: "Applied Data Analysis for Public Policy Studies"
subtitle: "Introduction"
author: "Michele Fioretti"
date: "Sciences Po Paris </br> `r Sys.Date()`"
output:
xaringan::moon_reader:
chakra: "https://cdnjs.cloudflare.com/ajax/libs/remark/0.14.0/remark.min.js"
lib_dir: libs
css: [default, "../css/scpo.css", "../css/scpo-fonts.css"]
nature:
beforeInit: ["../js/ru_xaringan.js"]
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
ratio: "16:9"
includes:
in_header: "../libs/partials/header.html"
---
layout: true
<div class="my-footer"><img src="../img/logo/ScPo-shield.png" style="height: 60px;"/></div>
and at the end
{r makepdf, echo=FALSE,eval=FALSE}
system("decktape chapter1.html chapter1.pdf --chrome-arg=--disable-web-security")
You cannot provide a .Rmd file to decktape. It has to be a HTML file, as it is done at:
It works if I run it as a chunk. Thank you for all your help!