Hello I'm trying to make some Javascript files working on nodeJS everything is well set however here is the error I get :
ReferenceError: navigator is not defined
at C:\Users\blaster\node_modules\mxgraph\javascript\dist\build.js:45:9
at Object.<anonymous> (C:\Users\blaster\Desktop\projet\entrainement_mxgraph\test_mxgraph.js:3:33)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
I try to make the example of code "hello world" under nodeJs for the project of a school, I am quite new in the concept nodeJs and the project javascript, my question is maybe simple or basic but I struggle with that for hours since yesterday
here's my code :
var express = require('express');
var mxgraph = require("mxgraph")({
mxImageBasePath: "./src/images",
mxBasePath: "mxgraph-master/mxgraph-master/javascript/src"
})
var mxEvent = mxgraph.mxEvent;
mxEvent.disableContextMenu(container);
var app = express();
app.get('/', function(req, res) {
// Checks if the browser is supported
if (!mxClient.isBrowserSupported())
{
// Displays an error message if the browser is not supported.
mxUtils.error('Browser is not supported!', 200, false);
}
else
{
// Disables the built-in context menu
mxEvent.disableContextMenu();
// Creates the graph inside the given container
var graph = new mxGraph();
// Enables rubberband selection
new mxRubberband(graph);
// Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0).
var parent = graph.getDefaultParent();
// Adds cells to the model in a single step
graph.getModel().beginUpdate();
try
{
var v1 = graph.insertVertex(parent, null, 'Hello,', 20, 20, 80, 30);
var v2 = graph.insertVertex(parent, null, 'World!', 200, 150, 80, 30);
var e1 = graph.insertEdge(parent, null, '', v1, v2);
}
finally
{
// Updates the display
graph.getModel().endUpdate();
}
}
});
app.listen(8080);
thank's you all.