gpt4 book ai didi

node.js - Imagemagick ENOENT 错误

转载 作者:行者123 更新时间:2023-12-02 14:26:17 25 4
gpt4 key购买 nike

不仅我有这个问题:Node js + imagemagick + Error: spawn ENOENT

console.log(appPath + '/public/avatar/tmp_' + filename);
var path = appPath + '/public/avatar/tmp_' + filename;
try {
fs.accessSync(path, fs.F_OK);
// Do something
console.log('file exists!');
} catch (e) {
// It isn't accessible
console.log('file does NOT exist!');
}

console.log('trying...');
// crop/resize image
im.crop({
srcPath: path,
dstPath: 'test1.png',
width: 60,
height: 60
}, function(err, stdout, stderr){
console.log('here');
if (err) {
console.log('trololololol '+err);
reject(err);
}
console.log('resized to fit within 60x60px');
resolve();
});

我得到控制台输出:

C:\www\instantynode\src/public/avatar/tmp_1458064183594_la5v9vcuc27hw7b9.png
file exists!
trying...
events.js:141
throw er; // Unhandled 'error' event
^

Error: spawn identify ENOENT
at exports._errnoException (util.js:870:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickCallback (node.js:356:17)

最佳答案

ENOENT 表示找不到identify。确保您已安装 ImageMagick 并且其安装在 $PATH 中的路径中。

关于node.js - Imagemagick ENOENT 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36018544/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com