Closed krillboi closed 4 years ago
@krillboi
Is this working ?
docusaurus-pdf
locally by yarn -D docusaurus-pdf
or npm --save-dev docusaurus-pdf
yarn run docusaurus-pdf options...
npm install --save-dev docusaurus-pdf
seems to have done the trick, thanks!
Hello, sorry for commenting on a closed topic (if you prefer, I open another issue).
I have the same question and even after npm install docusaurus-pdf
, I still have this error:
Error: Failed to launch the browser process!
/<my-dir>/.npm/_npx/2485/lib/node_modules/mr-pdf/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: error while loading shared libraries: libgtk-3.so.0: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md
at onClose (/<my-dir>/.npm/_npx/2485/lib/node_modules/mr-pdf/node_modules/puppeteer/lib/Launcher.js:750:14)
at Interface.<anonymous> (/home/joaovitorvvieira/.npm/_npx/2485/lib/node_modules/mr-pdf/node_modules/puppeteer/lib/Launcher.js:739:50)
at Interface.emit (events.js:327:22)
at Interface.close (readline.js:416:8)
at Socket.onend (readline.js:194:10)
at Socket.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1221:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Can you confirm how is the command I should execute after installing locally, please?
@joao-vieira
The below command not working ?
npm i --save-dev docusaurus-pdf
npm run docusaurus-pdf http://localhost:3000/myBaseUrl/docs/doc1 hoge.pdf
According to your error log, are you using mr-pdf
not docusaurus-pdf
??
This repogitory is docusaurus-pdf
.
Hello @KohheePeace, thanks for your reply.
First, excuse the confusion. The reported error is correct, it was using docusaurus-pdf
itself. However, I read other issues of this repo and saw your indication to use mr-pdf
, so I ended up putting the wrong log. Excuse me.
Regarding your comment, I followed the steps indicated and received this output:
$ npm install --save-dev docusaurus-pdf
> puppeteer@2.1.1 install /<my-project>/node_modules/puppeteer
> node install.js
Downloading Chromium r722234 - 121.1 Mb [====================] 100% 0.0s
Chromium downloaded to /<my-project>/node_modules/puppeteer/.local-chromium/linux-722234
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ docusaurus-pdf@1.2.0
added 19 packages from 41 contributors and audited 1694 packages in 46.857s
143 packages are looking for funding
run `npm fund` for details
found 2 low severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
$ npm run docusaurus-pdf http://localhost:3000/docs/anything hoge.pdf
npm ERR! missing script: docusaurus-pdf
npm ERR!
npm ERR! Did you mean this?
npm ERR! docusaurus
npm ERR! A complete log of this run can be found in:
npm ERR! /<my-user>/.npm/_logs/2020-10-12T19_41_35_982Z-debug.log
@joao-vieira sorry for late reply, you're correct I also encountered the same issue.
This is the solution.
In terminal
npm install --save-dev docusaurus-pdf
# You need this line
npm install puppeteer --save-dev
AND THEN
In package.json
{
"scripts": {
// ADD THIS LINE
"pdf": "docusaurus-pdf https://v2.docusaurus.io/docs/"
},
Again In terminal
npm run pdf
I hope this will solve your issue.
sorry for taking your time and troubling you.
Hi @KohheePeace ! First of all, don't worry, it's not a bother, you're helping me (and I have good news)!
I executed your commands and, at first, I had the following error:
$ npm run pdf
> deafend-documentation@0.0.0 pdf /<my-dir>
> docusaurus-pdf https://v2.docusaurus.io/docs/
Error: Failed to launch the browser process!
/<my-dir>/node_modules/docusaurus-pdf/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: error while loading shared libraries: libgtk-3.so.0: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md
at onClose (/<my-dir>/node_modules/docusaurus-pdf/node_modules/puppeteer/lib/Launcher.js:750:14)
at Interface.<anonymous> (/<my-dir>/node_modules/docusaurus-pdf/node_modules/puppeteer/lib/Launcher.js:739:50)
at Interface.emit (events.js:327:22)
at Interface.close (readline.js:416:8)
at Socket.onend (readline.js:194:10)
at Socket.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1221:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-project@0.0.0 pdf: `docusaurus-pdf https://v2.docusaurus.io/docs/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-project@0.0.0 pdf 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! /<my-dir>/.npm/_logs/2020-10-15T00_19_49_375Z-debug.log
But I found the answer here!
So after running sudo apt install libgtk-3-0
, I managed to generate the pdf of my documentation and left an example page below! 😄
Thank you for your help and congratulations on the work!
@joao-vieira glad to hear that 👍
Not sure if this is a problem on the plugin's side, but everytime I execute
npx docusaurus-pdf
it starts downloading the Chromium browser again. Since this takes about a minute, the turn around time for testing the pdf output is a little long.Can anyone reproduce this?