Chromium dependency in asciidoctorj CLI

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Chromium dependency in asciidoctorj CLI

apj68
I usually am building documentation via gradle but today I installed the asciidoctorj CLI for converting one-off documents quickly.  However, I'm having trouble rendering a mermaid diagram.  I'm getting this:

PS C:\> asciidoctorj.bat -r asciidoctor-diagram .\mag-workitem.adoc
uri:classloader:/gems/asciidoctor-diagram-2.1.0/lib/asciidoctor-diagram/util/cli_generator.rb:53: warning: Tempfile#unlink or delete called on open file; ignoring
Mar 12, 2021 10:46:46 AM uri:classloader:/gems/asciidoctor-2.0.12/lib/asciidoctor/parser.rb build_block
SEVERE: mag-workitem.adoc: line 23: Failed to generate image: mmdc.cmd failed: C:\Users\MyPowerShell\node_modules\puppeteer\lib\cjs\puppeteer\node\Launcher.js:80
                    throw new Error(missingText);
                          ^

Error: Could not find expected browser (chrome) locally. Run `npm install` to download the correct Chromium revision (848005).
    at ChromeLauncher.launch (C:\Users\MyPowerShell\node_modules\puppeteer\lib\cjs\puppeteer\node\Launcher.js:80:27)

PS C:\> npm install chromium@848005
npm ERR! code ETARGET
npm ERR! notarget No matching version found for chromium@848005.
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!     C:\Users\AppData\Roaming\npm-cache\_logs\2021-03-12T18_49_25_644Z-debug.log

I do have a version of chromium installed, though apparently it's not at the requested version:

PS C:\> npm list chromium
C:\Users\MyPowerShell
`-- chromium@3.0.2

Any suggestions on either getting this CLI to work or another CLI option with which I can process mermaid diagrams?


Andy
Reply | Threaded
Open this post in threaded view
|

Re: Chromium dependency in asciidoctorj CLI

mojavelinux
Administrator
Andy,

The dependency on Chrome is coming indirectly from Asciidoctor Diagram (not the AsciidoctorJ CLI directly). Asciidoctor Diagram allows you to pass a config file to puppeteer using the `puppeteer-config` attribute. See https://docs.asciidoctor.org/diagram-extension/latest/#mermaid From there, you can tell puppeteer which binary to use. See https://github.com/puppeteer/puppeteer/blob/v8.0.0/docs/api.md#puppeteerlaunchoptions

Puppeteer does claim to use a bundled distribution of Chromium by default, so I'm not sure why it has to be specified. But perhaps you can figure it out ;)

Best Regards,

-Dan

On Fri, Mar 12, 2021 at 12:04 PM apj68 [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I usually am building documentation via gradle but today I installed the asciidoctorj CLI for converting one-off documents quickly.  However, I'm having trouble rendering a mermaid diagram.  I'm getting this:

PS C:\> asciidoctorj.bat -r asciidoctor-diagram .\mag-workitem.adoc
uri:classloader:/gems/asciidoctor-diagram-2.1.0/lib/asciidoctor-diagram/util/cli_generator.rb:53: warning: Tempfile#unlink or delete called on open file; ignoring
Mar 12, 2021 10:46:46 AM uri:classloader:/gems/asciidoctor-2.0.12/lib/asciidoctor/parser.rb build_block
SEVERE: mag-workitem.adoc: line 23: Failed to generate image: mmdc.cmd failed: C:\Users\MyPowerShell\node_modules\puppeteer\lib\cjs\puppeteer\node\Launcher.js:80
                    throw new Error(missingText);
                          ^

Error: Could not find expected browser (chrome) locally. Run `npm install` to download the correct Chromium revision (848005).
    at ChromeLauncher.launch (C:\Users\MyPowerShell\node_modules\puppeteer\lib\cjs\puppeteer\node\Launcher.js:80:27)

PS C:\> npm install chromium@848005
npm ERR! code ETARGET
npm ERR! notarget No matching version found for chromium@848005.
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!     C:\Users\AppData\Roaming\npm-cache\_logs\2021-03-12T18_49_25_644Z-debug.log

I do have a version of chromium installed, though apparently it's not at the requested version:

PS C:\> npm list chromium
C:\Users\MyPowerShell
`-- chromium@3.0.2

Any suggestions on either getting this CLI to work or another CLI option with which I can process mermaid diagrams?


Andy


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Chromium-dependency-in-asciidoctorj-CLI-tp8564.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen (he, him, his) | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: Chromium dependency in asciidoctorj CLI

apj68
OOPs, I missed that extra documentation!

I tried a few things with the environment variables (setting PUPPETEER_CHROMIUM_REVISION, then trying to switch to firefox with PUPPETEER_PRODUCT).  Turns out that chromium was not installed, after I went into the module and ran npm install then it installed the version of chromium that it wanted.

Thanks for the pointer, Dan!