Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to setup up mermaid to use already installed chromium? #331

Closed
habdank opened this issue Jul 11, 2022 · 2 comments · Fixed by #390
Closed

How to setup up mermaid to use already installed chromium? #331

habdank opened this issue Jul 11, 2022 · 2 comments · Fixed by #390

Comments

@habdank
Copy link

habdank commented Jul 11, 2022

Hi!

We have installed by corporate platform Chromium based browser.
Due to security policies, no other browser is allowed.

Therefore starting mermaid-cli I am getting the following error:

Error: spawn EPERM
    at ChildProcess.spawn (internal/child_process.js:403:11)
    at Object.spawn (child_process.js:553:9)
    at BrowserRunner.start (C:\Data\Tools\mermaid\node_modules\puppeteer\lib\cjs\puppeteer\node\BrowserRunner.js:116:34)
    at ChromeLauncher.launch (C:\Data\Tools\mermaid\node_modules\puppeteer\lib\cjs\puppeteer\node\Launcher.js:117:16)

Is it possible to configure mermaid-cli to use other (pre-installed) chromium?

Thanks in advance for help.

@aloisklink
Copy link
Member

aloisklink commented Jul 15, 2022

Yes, it should be possible on Linux/MacOS, although I've got no idea if it will work on Windows.

If you run mermaid-cli with the --help flag, there's an option for --puppeteerConfigFile, which is a JSON configuration file for puppeteer.

These are options passed to puppeteer.launch.

The useful options for you are:

You'll probably want a file called puppeteerConfigFile.json with contents:

{
  "executablePath": "C:\\path\\to\\your\\chrome.exe"
}

Then run mermaid-cli with option mmdc --puppeteerConfigFile puppeteerConfigFile.json.

You might also be able to do the same thing with environment variables by following: https://pptr.dev/#environment-variables.

Btw, if you set PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 as an env variable when running yarn install or npm install, it should skip downloading CHROMIUM too.

@MindaugasLaganeckas
Copy link
Member

@habdank : if you can confirm the solution above, then we will create a section in our docs for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants