nidi3 / graphviz-java

Use graphviz with pure java
Apache License 2.0
937 stars 107 forks source link

TypeError: Module.print is not a function #110

Closed JanWichniarek closed 5 years ago

JanWichniarek commented 5 years ago

When I try to save large graph to file I got:

Exception in thread "main" guru.nidi.graphviz.engine.GraphvizException: TypeError: Module.print is not a function at guru.nidi.graphviz.engine.ResultHandler.waitFor(ResultHandler.java:42) at guru.nidi.graphviz.engine.GraphvizV8Engine$Env.execute(GraphvizV8Engine.java:91) at guru.nidi.graphviz.engine.GraphvizV8Engine.jsExecute(GraphvizV8Engine.java:67) at guru.nidi.graphviz.engine.AbstractJsGraphvizEngine.execute(AbstractJsGraphvizEngine.java:30) at guru.nidi.graphviz.engine.Graphviz.execute(Graphviz.java:192) at guru.nidi.graphviz.engine.Renderer.toImage(Renderer.java:78) at guru.nidi.graphviz.engine.Renderer.toFile(Renderer.java:55) ...

By "large" I mean about 45 nodes with 10 edges connected to each od them. I am able to save graph with about 40 nodes, but adding a little more ends with mentioned error.

nidi3 commented 5 years ago

Strange enough, this is an out of memory problem. It can be solved using the totalMemory method: Graphviz.fromGraph(g).totalMemory(24000000).render(PNG).toFile(...); This does not work currently, so I wrote a fix. So use version 0.8.5.

nidi3 commented 3 years ago

I improved the error handling in 0.18.1 so instead of TypeError: Module.print is not a function the real problem should be logged.