exupero / saveSvgAsPng

Save SVGs as PNGs from the browser.
MIT License
1.09k stars 362 forks source link

ReferenceError: navigator is not defined (using Node.js) #242

Open GalaxySH opened 4 years ago

GalaxySH commented 4 years ago

Downloaded the library with npm and trying to use it with node, I am trying to make an image using this and d3.

const saveSvgAsPng = require("save-svg-as-png");
...
saveSvgAsPng.saveSvgAsPng(chart, "ch.png");
GalaxySH commented 4 years ago

I just added var navigator = {} and that error went away, but now it's saying that document isn't defined, but I defined it in the file I'm requiring it as with const document = new JSDOM().