当我尝试像这样调整图像大小时:
gm('public/uploads/1710410635.jpg')
.resize(240, 240)
.noProfile()
.write('public/uploads/1710410635_t.jpg', function (err) {
if (!err) console.log('done');
});我得到了这个错误:
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:945:11)
at Process.ChildProcess._handle.onexit (child_process.js:736:34)我的文件结构如下:

代码在postnewsitem.js文件中执行
为什么会发生这个错误?我该如何解决它?
编辑: GraphicsMagick works,证明:

发布于 2016-07-09 19:36:27
/ gm /lib/command.js有一个选项,您可以在其中设置本地,如果gm已经通过终端工作,您可以获得gm的路径并通过subClass函数传递它,在我的例子中,gm是使用MacOsx上的brew安装在/usr/ appPath /bin/中的。
var gm = require('gm').subClass({ appPath: "/usr/local/bin/" });https://stackoverflow.com/questions/16222116
复制相似问题