Open gsmitheidw opened 3 weeks ago
- Provision of a prebuilt binary mmdc that includes the puppeteer functionality compiled in
We do have an issue for this https://github.com/mermaid-js/mermaid-cli/issues/467, but as it's a non-trivial amount of work, I don't think it would get done anytime soon.
- An alternative in the code to puppeteer that will allow the npm installation to complete, perhaps using a different dependency.
Unfortunately, mermaid-cli requries Puppeteer (or something similar like Playwright), since Mermaid doesn't support server-side rendering, see https://github.com/mermaid-js/mermaid-cli/issues/750
As an alternate approach, can you install a chromium/firefox browser a different way (e.g. via apt install
or apk add
?
If so, you can install @mermaid-js/mermaid-cli
with PUPPETEER_SKIP_DOWNLOAD=true
enabled, e.g.
PUPPETEER_SKIP_DOWNLOAD=true npx @mermaid-js/mermaid-cli --help
Then, make a puppeteerConfig.json
file with the executablePath
key pointing to your version of chrome/firefox, e.g. like:
Then, you pass it via --puppeteerConfigFile
:
PUPPETEER_SKIP_DOWNLOAD=true npx @mermaid-js/mermaid-cli --puppeteerConfigFile puppeteer-config.json
There are some docs in https://pptr.dev/troubleshooting#running-puppeteer-in-docker and https://github.com/puppeteer/puppeteer/issues/9460 that might help.
Hello just today I made this tutorial on the subject of Puppeteer on Android that might help
https://gist.github.com/robertkirkman/0c2f3426024069546ed9b7bb2f26cb99
That looks like a good workaround albeit very heavy in terms of storage to install a full desktop environment just to run a small utility.
For anyone already using Termux with desktop this would be ideal.
I think the browser dependency is kinda non-negotiable, but perhaps the X desktop can be removed after getting the mmdc installed?
Hello just today I made this tutorial on the subject of Puppeteer on Android that might help
https://gist.github.com/robertkirkman/0c2f3426024069546ed9b7bb2f26cb99
There is currently a Segmentation fault in the command firefox -headless
, preventing the opening of firefox
without X11 server present. I will try fix it maybe I can I'm not sure. If I can I will send the patch
I am happy to announce good news that I have fixed the Segmentation fault error, and integrated the patch into a PR into the termux-packages repository, and also updated my guide to have a Headless Mode section that has a full code example for using Puppeteer on Android in Headless mode (would start working whenever the PR is accepted and Termux mirrors are updated. If the PR turns out to have bugs or other issues, and can't be accepted to termux-packages yet, then I will eventually post directions for using it as a custom downstream build of Firefox specifically for Headless Node.js Puppeteer on Android, so that the custom build could be used for that purpose without breaking Firefox for other users)
I would like install mermaid-cli on Android in Termux. It's failing on puppeteer install citing "current platform is not supported"
My desire is to be able to create mmd files in vim in Termux and use them in conjunction with pandoc to create documents with embedded diagrams.
Test environment
Termux from the (recommended) F-Droid store
Solutions explored:
Workaround I've explored include messy workarounds using rooted devices and docker or proot distros which is quite a heavy-handed (particularly in terms of Android resources) solution to installing an otherwise small package. I've tried installing puppeteer-core but that does not work.
Potential Solutions: