Javascript 总经理图书馆/网页问题

Javascript 总经理图书馆/网页问题,javascript,node.js,reactjs,electron,gm,Javascript,Node.js,Reactjs,Electron,Gm,我正在尝试使用这个包gm from node,它还要求我在顶部使用fs。它给了我一些错误,但我通过将此配置添加到我的webpack.config文件中进行了修复: node: { fs: "empty", child_process: "empty" } 添加此选项后,将显示新的警告: 未找到模块:错误:无法解析和目录路径中的模块“生成同步” 当我使用这个库的裁剪函数时,我得到TypeError:cp.spawn不是一个函数我使用的代码是: gm("The path to th

我正在尝试使用这个包gm from node,它还要求我在顶部使用fs。它给了我一些错误,但我通过将此配置添加到我的webpack.config文件中进行了修复:

node: {
    fs: "empty",
    child_process: "empty"
}
添加此选项后,将显示新的警告:

未找到模块:错误:无法解析
和目录路径中的模块“生成同步”

当我使用这个库的裁剪函数时,我得到
TypeError:cp.spawn不是一个函数
我使用的代码是:

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);
      });
现在我在react中使用这个,它在electron中运行。代码有什么问题吗?或者我能做些什么来让它工作


我所要做的就是裁剪一张图片,给出我想要裁剪的起始点和起始点。

npm安装spawn sync
然后重试?@SteevePitis谢谢你,我尝试过这么做,但在我安装该软件包后,它让我安装spawn sync try thread sleep aws sdk module tls net tap console这个软件包现在它告诉我这个错误:
模块构建失败:错误:enoint:没有这样的文件或目录,在错误(本机)时打开“main directory/node\u modules/spawn sync/index.js”
怪异,杀死electron并重建它?@SteevePitis它工作了,但现在它有更多警告,我尝试安装软件包,但仍然给我同样的问题。到目前为止,我已经安装了
spawn sync try thread sleep aws sdk module tls net tap console directory node gyp npm file
,并且出现了如下错误:
module not found:Error:无法解析“file”或“directory”
和/main dir/~/try thread sleep/~/thread sleep/index.js中的
警告关键依赖项:
spawn sync
然后重试?@SteevePitis谢谢,我尝试过这么做,但在我安装该软件包后,它让我安装了spawn sync try thread sleep aws sdk module tls net tap console此软件包现在它会出现以下错误:
模块构建失败:错误:enoint:没有这样的文件或目录,错误时打开“main directory/node\u modules/spawn sync/index.js”(本机)
wird,杀死electron并重建它?@SteevePitis它可以工作,但现在它有更多警告,我尝试安装软件包,但仍然出现同样的问题。到目前为止,我已经安装了
spawn sync try thread sleep aws sdk module tls net tap console directory node gyp npm file
,并且出现了如下错误:
module not found:Error:无法解析“file”或“directory”
和/main dir/~/try thread sleep/~/thread sleep/index.js中的
警告关键依赖项: