question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cli error rendering stateDiagram on MacOs

See original GitHub issue

Describe the bug Error generating image from .mmd with mmdc installed via npm when input file starts with a state diagram:

(node:63597) UnhandledPromiseRejectionWarning: Error: Evaluation failed: Error: Parse error on line 1:
stateDiagram	[*] --
^
Expecting 'NEWLINE', 'SPACE', 'GRAPH', got 'ALPHA'
    at Yt.parseError (file:///Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/mermaid.cli/mermaid.min.js:1:486512)
    at Yt.parse (file:///Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/mermaid.cli/mermaid.min.js:1:487678)
    at Object.e.getClasses (file:///Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/mermaid.cli/mermaid.min.js:1:749437)
    at Object.render (file:///Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/mermaid.cli/mermaid.min.js:1:759998)
    at s (file:///Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/mermaid.cli/mermaid.min.js:8:233)
    at Object.init (file:///Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/mermaid.cli/mermaid.min.js:8:318)
    at __puppeteer_evaluation_script__:17:20
    at ExecutionContext._evaluateInternal (/Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/puppeteer/lib/ExecutionContext.js:122:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  -- ASYNC --
    at ExecutionContext.<anonymous> (/Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/puppeteer/lib/helper.js:111:15)
    at ElementHandle.evaluate (/Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/puppeteer/lib/JSHandle.js:55:42)
    at ElementHandle.<anonymous> (/Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/puppeteer/lib/helper.js:112:23)
    at ElementHandle.$eval (/Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/puppeteer/lib/JSHandle.js:478:40)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  -- ASYNC --
    at ElementHandle.<anonymous> (/Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/puppeteer/lib/helper.js:111:15)
    at DOMWorld.$eval (/Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/puppeteer/lib/DOMWorld.js:156:21)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  -- ASYNC --
    at Frame.<anonymous> (/Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/puppeteer/lib/helper.js:111:15)
    at Page.$eval (/Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/puppeteer/lib/Page.js:347:29)
    at Page.<anonymous> (/Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/puppeteer/lib/helper.js:112:23)
    at /Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/mermaid.cli/index.bundle.js:83:14
    at Generator.next (<anonymous>)
    at step (/Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/mermaid.cli/index.bundle.js:4:191)
    at /Users/pmorgano/Developement/projects/UmlFlowsCentraleOperativa/node_modules/mermaid.cli/index.bundle.js:4:361
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:63597) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:63597) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

To Reproduce Steps to reproduce the behavior: Test.mmd file content:

stateDiagram
	[*] --> Still
	Still --> [*]

	Still --> Moving
	Moving --> Still
	Moving --> Crash
	Crash --> [*]

Command line:

./node_modules/.bin/mmdc -i graphs/Test.mmd assets/Test.png

Expected behavior Test.png is rendered

Desktop (please complete the following information):

  • OS: macOS Catalina 10.15.2
  • Node version: v10.16.0 and v13.7.0
  • Cli Version:
 "mermaid.cli": {
      "version": "0.5.1",
      "resolved": "https://npm.ff3d.com/mermaid.cli/-/mermaid.cli-0.5.1.tgz",
      "integrity": "sha512-03aKyM1nH86Hk16xiP7Hiswg2CuJ4iFkwDdWln00Irx4E81fy1FPUzXon3JVckp1MkxKtDHJlg3SudlLwKsndQ==",
      "dev": true,
      "requires": {
        "chalk": "^2.4.1",
        "commander": "^2.15.1",
        "puppeteer": "^1.4.0"
      }
    }```

**Additional context**
VScode preview and Live editor preview do work with the same file content

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
stytscommented, Apr 9, 2020

@tylerlong could the old repo be made more explicit about avoiding this confusion? warning signs, npm package deletion or modification to show a warning right away if installed?

5reactions
stytscommented, Apr 9, 2020

I just had something like this… You have "version": "0.5.1", the current is “8.4.8” - you’re waaay behind. Maybe you made the same error as me and installed the old “mermaid.cli” npm package? The correct package is installed with npm install @mermaid-js/mermaid-cli.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MacOS cli program permission denied - Apple Developer
Hi all. I'm currently experiencing a problem where I'm testing the HelloPhotogrametry command line app released by Apple.
Read more >
call it from your script using command line - PlantUML
When there are some errors in diagrams the command returns an error (-1) ... for class diagram -tscxml To generate SCXML file for...
Read more >
Mermaid Cheat Sheet @ https://jojozhuang.github.io
This diagrammatic representation illustrates a solution model to a given problem. 1.1 Graph. Possible directions are: TB - top bottom; BT - bottom...
Read more >
mermaid | Yarn - Package Manager
Important: This documentation covers modern versions of Yarn. For 1.x docs, see classic.yarnpkg.com. Yarn. ≡. Home · Getting started · Features · CLI....
Read more >
Mermaid: Create diagrams and visualizations using text and ...
For those using VS Code, this GitHub Markdown extension also renders mermaid: ... ```mermaid stateDiagram [*] --> start start --> zero : 0...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found