Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

check mmdc via running in case of setup failed.

geekan748ef5535ac8
diff --git a/metagpt/utils/mermaid.py b/metagpt/utils/mermaid.py
index c03f4d4e0..75978673e 100644
--- a/metagpt/utils/mermaid.py
+++ b/metagpt/utils/mermaid.py
@@ -13,7 +13,7 @@ from metagpt.logs import logger
from metagpt.utils.common import check_cmd_exists
-def mermaid_to_file(mermaid_code, output_file_without_suffix, width=2048, height=2048):
+def mermaid_to_file(mermaid_code, output_file_without_suffix, width=2048, height=2048) -> int:
"""suffix: png/svg/pdf
:param mermaid_code: mermaid code
@@ -29,6 +29,7 @@ def mermaid_to_file(mermaid_code, output_file_without_suffix, width=2048, height
tmp.write_text(mermaid_code, encoding='utf-8')
if check_cmd_exists('mmdc') != 0:
+ logger.warning("RUN `npm install -g @mermaid-js/mermaid-cli` to install mmdc")
return -1
for suffix in ['pdf', 'svg', 'png']:
diff --git a/setup.py b/setup.py
index 1cdfa1169..790c90650 100644
--- a/setup.py
+++ b/setup.py
@@ -15,7 +15,7 @@ class InstallMermaidCLI(Command):
def run(self):
try:
- subprocess.check_call(['sudo', 'npm', 'install', '-g', '@mermaid-js/mermaid-cli'])
+ subprocess.check_call(['npm', 'install', '-g', '@mermaid-js/mermaid-cli'])
except subprocess.CalledProcessError as e:
print(f"Error occurred: {e.output}")