mermaid-js / mermaid-cli

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

Unable to parse class diagram on v10.1.0 #532

Closed deanpribetic closed 1 year ago

deanpribetic commented 1 year ago

Describe the bug Unable to parse classes on macOS on 10.1.0. Produces the following error (truncated)

Error: Evaluation failed: Error: Parse error on line 2:
...-v2class Pancake {}class Waffle {}
---------------------^
Expecting 'MEMBER', got 'STRUCT_STOP'
    at pptr://__puppeteer_evaluation_script__:45:17

To Reproduce Steps to reproduce the behavior:

  1. Make a text file with the following:
classDiagram-v2
    class Pancake {
    }
    class Waffle {
    }
  1. Run via npm mmdc to produce and output. Something like npm mmdc -i example.txt -o output.png

Expected behavior Expect an image file named output.png to contain two classes Pancake and Waffle.

Desktop (please complete the following information):

Additional context I have looked into issues #433 and #503 and neither seem to offer anything that helps

MindaugasLaganeckas commented 1 year ago

Have you seen this https://github.com/mermaid-js/mermaid-cli#install-with-brew? Try to use docker instead.

deanpribetic commented 1 year ago

Have you seen this https://github.com/mermaid-js/mermaid-cli#install-with-brew? Try to use docker instead.

I am using this through npm

aloisklink commented 1 year ago

Issue confirmed. I've even tested with the Mermaid v10.2.0-rc.2 candidate, and it didn't help.

There has been a bunch of recent updates to class diagrams in Mermaid recently (e.g. https://github.com/mermaid-js/mermaid/commit/ba632ff65bcaf6752364c3668a25f7376615204e), so I'm hoping that maybe the soon to be released Mermaid v10.2.0 might fix this issue.

This diagram works fine in https://mermaid.live and on GitHub, so it must be a mermaid-cli issue:

classDiagram-v2
    class Pancake {
    }
    class Waffle {
    }
MindaugasLaganeckas commented 1 year ago

Thank you for confirming. Sorry for sleeping. Hmm. I guess we do not have any Percy tests for class diagrams. Wonder how can this be mermaid-cli problem? Let's wait for mermaid v10.2.0