mermaid-js / mermaid-cli

Command line tool for the Mermaid library
MIT License
2.35k stars 227 forks source link

File generation not happening #552

Closed jaques-sam closed 1 year ago

jaques-sam commented 1 year ago

Description mmdc doesn't generate a file nor outputs any error. I tried all 3 supported output types. I tried also inside the directory itself. I did an npm uninstall mmdc + npm install mmdc None of them worked.

How to reproduce

❯ cat doc/assets/virtual_microphone.mmd              
---
title: Virtual microphone
---

graph LR
    A[AES6 Dante IN] --> B[AES67-daemon] --> C[ALSA Sink]

❯ mmdc -i doc/assets/virtual_microphone.mmd -o vm.png

❯ ls doc/assets/vm.png

❯ ls vm.png           
ls: cannot access 'vm.png': No such file or directory

❯ mmdc -V                                            
0.5.1

Expected behavior I expect the png/pdf/svg file being generated.

Desktop

jaques-sam commented 1 year ago

Investigated a bit further myself. Seems I installed an old version :-o Why is there an official "mmdc" package that's doing the same more or less and why is it so old and not working???

Probably tried before (and missed the error before), this was the issue:

❯ sudo npm install -g @mermaid-js/mermaid-cli
[sudo] password for samja: 
npm ERR! code EEXIST
npm ERR! path /usr/local/bin/mmdc
npm ERR! EEXIST: file already exists
npm ERR! File exists: /usr/local/bin/mmdc
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-06-15T09_32_30_438Z-debug-0.log

Solved by removing it manually:

❯ sudo rm -rf /usr/local/bin/mmdc

Reinstalled using correct (new?) install method:

❯ sudo npm install -g @mermaid-js/mermaid-cli
aloisklink commented 1 year ago

Hmmmm, that's weird. I actually own the mmdc package, but the only thing it does is install @mermaid-js/mermaid-cli, see https://www.npmjs.com/package/mmdc.

Because of that, it should be completely compatible with npm install -g @mermaid-js/mermaid-cli.

(it's mainly there to prevent someone else from stealing the mmdc package and sticking some malicious code there, like the tsc package)

IMO, in case you're curious, there's some discussion about possibly changing the name of this package in https://github.com/mermaid-js/mermaid-cli/issues/433!