MODULE NAME 'fs' HAS NOT BEEN LOADED YET FOR CONTEXT by using viz.js

Hi,

I got a problem when used viz.js to create graph. You can see the code as follow:

var deps = [
"viz.js"
];

require( deps, function() {
drawGraph();
});

function drawGraph(){
var g = "digraph G { a1 -> b3; b2 -> a3; a3 -> a0; }";
var tt=Viz(g,"svg");
document.body.innerHTML += tt;
}

I got the error: Uncaught Error: Module name "fs" has not been loaded yet for context: _. Use require([])
http://requirejs.org/docs/errors.html#notloaded

Then I checked the viz.js file, and I found the problem in the file:

var Ub=require("fs"),var Vb=require("path");

You can find this line in the viz.js file. I have checked on the Internet. It should be like :

require(["fs","path"], function() {
var Ub=require("fs"),var Vb=require("path");
});

Is this a mistake? If not, how to solve this problem?

Thanks in advanced.

I was able to respond to your

I was able to respond to your earlier posts based on my elementary understanding of javascript, but this one is currently beyond me. As viz.js was not written by us (we just provide the graphviz portion), you may want to post your query at the viz.js site https://github.com/mdaines/viz.js/ or contact one of the authors listed there.

Recent comments