Mermaid-cli on macOS


It seems mermaid-cli needs chromium and it’s not managed through its dependencies, since chromium is not supported on aarch64-darwin. I had the following error:

Error: Could not find Chromium (rev. 1108766). This can occur if either
 1. you did not perform an installation before running the script (e.g. `npm install`) or
 2. your cache path is incorrectly configured (which is: /Users/joris/.cache/puppeteer).
For (2), check out our guide on configuring puppeteer at
    at ChromeLauncher.resolveExecutablePath (file:///nix/store/5vvq719z7i0dm5p90nirrf142d44fp1k-mermaid-cli-10.8.0/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/node/ProductLauncher.js:263:27)
    at ChromeLauncher.executablePath (file:///nix/store/5vvq719z7i0dm5p90nirrf142d44fp1k-mermaid-cli-10.8.0/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js:176:25)
    at ChromeLauncher.computeLaunchArguments (file:///nix/store/5vvq719z7i0dm5p90nirrf142d44fp1k-mermaid-cli-10.8.0/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js:93:37)
    at async ChromeLauncher.launch (file:///nix/store/5vvq719z7i0dm5p90nirrf142d44fp1k-mermaid-cli-10.8.0/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/node/ProductLauncher.js:57:28)
    at async run (file:///nix/store/5vvq719z7i0dm5p90nirrf142d44fp1k-mermaid-cli-10.8.0/lib/node_modules/@mermaid-js/mermaid-cli/src/index.js:404:19)
    at async cli (file:///nix/store/5vvq719z7i0dm5p90nirrf142d44fp1k-mermaid-cli-10.8.0/lib/node_modules/@mermaid-js/mermaid-cli/src/index.js:184:3)

Granted, I don’t know how it worked before that (I had the nodePackages.mermaid-cli) I opted to install chromium through homebrew and using an overlay to point the working binary to the makeWrapper , but I wonder if there is a better way to handle this. If there is none, is it possible to display a message to the users having this setup to help them configure the package?

If you lookup the source code of the nix pkgs:

it used puppeteer+chromium, I think you could change chromium for chrome and get the same result through a derivation …

Neither chromium nor chrome are packaged for aarch64-darwin through nix, so I’m not sure what’s your suggestion (redefining the installPhase to make the wrapper point to the chromium of homebrew is the workaround I mention previously). I don’t think they ever were packaged for but nodePackages.mermaid-cli was still working fine without it at some point.