1

I'm trying to use this package gm from node that also require that I require fs on the top. It was giving me some error but I fix it adding this configuration to my webpack.config file:

node: {
    fs: "empty",
    child_process: "empty"
}

After adding this a new warning show up:

Module not found: Error: Cannot resolve module 'spawn-sync' in and directory path.

And when I use the crop function of this library I get TypeError: cp.spawn is not a function the code that I use is:

gm("The path to the picture")
      .crop(2574, 1872, 279, 567)
      .write("path and name of the new file", (err) => {
        if (!err) console.log("done");
        if (err) console.log(err);
      });

Now I'm using this in react, and its running in electron. Is there anything wrong with the code ? or is anything I can do to make it work ?

All I'm trying to do is crop a picture giving the start point and the are that i want to crop.

4

0 回答 0