「Mermaid」- Running as root without –no-sandbox is not supported

  CREATED BY JENKINSBOT

问题描述

当运行 mmdc 命令时,产生如下错误:

# mmdc -i demo.mmd -o demo.png
/usr/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer/lib/cjs/pup
peteer/node/BrowserRunner.js:193
            reject(new Error([
                   ^

Error: Failed to launch the browser process!
[1223/191612.455014:FATAL:zygote_host_impl_linux.cc(117)] No usable sandbox! Upd
ate your kernel or see https://chromium.googlesource.com/chromium/src/+/master/d
ocs/linux/suid_sandbox_development.md for more information on developing with th
e SUID sandbox. If you want to live dangerously and need an immediate workaround
, you can try using --no-sandbox.
#0 0x56445399fb39 base::debug::CollectStackTrace()
#1 0x5644539124c3 base::debug::StackTrace::StackTrace()
#2 0x564453922c80 logging::LogMessage::~LogMessage()

问题原因

因为没有什么研究,所以原因我们也并不清楚(这各问题可是经常出现的)。

解决方法

第一步、创建 puppeteer-config.json 文件:

{
  "args": ["--no-sandbox"]
}

第二步、使用该配置文件运行:

mmdc -p puppeteer-config.json ...

参考文献

mermaid-cli/linux-sandbox-issue.md at master · mermaid-js/mermaid-cli
Solve “The SUID sandbox helper binary was found, but is not configured correctly.” (3 solutions!) | by Authmane Terki | Medium