Search code examples
javascriptnode.jscanvasnode-webkit

Exception in NodeWeb Kit for Canvas


I am trying to convert my nodejs application into an .exe file. I am stuck with the canvas module(npm install @tensorflow/tfjs canvas). For some reason,nw.js is not able to load this module.

This is the line for which I am getting the error :

const canvas = require("canvas");

And this is the error :

enter image description here

I did go through this but unfortunately it didn't help. My node version is : 16.10.10 and nw.js version is : 0.57.1. Using Windows10.

Is there any way in which this can be solved ? Thanks.


Solution

  • I was not able to solve the above error where I was using node webkit, hence I switched to pkg, and it worked.

    pkg is CLI that allows you to package or bundle your node.js project into an executable file. The generated executed file can be run on devices which do not have nodejs installed.

    More info about pkg can be found here.