3

I'm trying to get started with Mermaid CLI but when I try to run it against my source file it says it can't find phantomjs. (I'm running Win 7 64.)

C:\Users\Chris\Documents>mermaid test.mermaid

You had errors in your syntax. Use --help for further information.
Could not find phantomjs at the specified path.

However phantomjs is in my path and I have no problems running it from the command prompt.

C:\Users\Chris\Documents>phantomjs
phantomjs>

I also tried putting the phantomjs path in directly. This didn't help.

C:\Users\Chris\Documents>mermaid -e "C:\Users\Chris\AppData\Roaming\npm" test.mermaid

You had errors in your syntax. Use --help for further information.
Could not find phantomjs at the specified path.

Curiously, if I ask for verbose feedback it also tells me it needs a source file

C:\Users\Chris\Documents>mermaid -v test.mermaid

You had errors in your syntax. Use --help for further information.
You must specify at least one source file.
Could not find phantomjs at the specified path.

So, I'm wondering if there is something wrong with my source. Which, I had just copied from the readme. The source file looks like:

A[Hard edge] -->|Link text| B(Round edge)
B --> C{Decision}
C -->|One| D[Result one]
C -->|Two| E[Result two]

Any thoughts would be much appreciated.

jww
  • 97,681
  • 90
  • 411
  • 885
Chris
  • 1,313
  • 2
  • 13
  • 26

3 Answers3

0

Check this bug https://github.com/knsv/mermaid/issues/329 which is not really specific to OS X.

It seems that mermaid project has some very weird way of relying on specific versions on dependent libraries and for this reason is extremely hard to succeed making it run.

Also, do not ignore this bug https://github.com/knsv/mermaid/issues/304 -- which is asking for making it able to use phantomjs 2.x instead of the too old version 1.9.8

sorin
  • 161,544
  • 178
  • 535
  • 806
0

I also encountered the same problem, but has been resolved. You need to pay attention to the command format.

Like this: mermaid -p -o /tmp -w 3600 -e /opt/node-v4.4.7-linux-x64/bin/phantomjs test.mmd

My environment: node-v4.4.7-linux-x64 phantomjs - 2.1.1

If there is a problem, sure that these dependencies. d3,dagre,dagre-d3,jasmine

Good luck

Lue
  • 1
0

I solve this problem. I noticed that, if you install phantomjs by this npm -g install phantomjs, actually it is wrong, and I don't know why.

phantomjs --help
internal/child_process.js:294
var err = this._handle.spawn(options);
                     ^

TypeError: Bad argument
at ChildProcess.spawn (internal/child_process.js:294:26)
at exports.spawn (child_process.js:386:9)
at Object.<anonymous> (/usr/local/lib/node_modules/phantomjs-prebuilt/bin/phantomjs:22:10)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:425:7)

So I download from this,

and npm remove mermaid

and npm install -g mermaid, done.

finally :

mermaid

You had errors in your syntax. Use --help for further information.
You must specify at least one source file.
Zheng Xiaodong
  • 143
  • 3
  • 9