canvas2image
canvas2image copied to clipboard
canvas2image npm not working
After installing canvas2image npm. I am getting the following error:
TypeError: Canvas2Image.saveAsPNG is not a function
the reason why using npm doesn't work is that the node_module 'canvas2image' only contains the 'var Canvas2image=function(){...' . you could replace 'module.exports=function(){...' instead of ''var Canvas2image=function(){...' in the node_module js file 'canvas2image.js', then using 'require()' does work.
I created a fork, that uses ES6 modules so you can import it: https://github.com/TessyPowder/canvas2image-2