Reputation: 40561
Not only I have this issue: 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();
});
I get the console output:
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)
Upvotes: 5
Views: 5170
Reputation: 16312
Just making npm install imagemagick
does not suffice because the npm package does not contain any binaries, just node scripts which rely on the binaries.
You still have to install the binaries, in Debian/Ubuntu, you just need to do
sudo apt install imagemagick
Upvotes: 2
Reputation: 51
I realize this several years late but I just ran into this issue and was able to solve it. I thought I'd post the solution here for the next poor sap who runs into this.
identify is a legacy utility that can optionally be installed with ImageMagick. By default, it is not installed.
Upvotes: 4
Reputation: 551
I was also having this error , what I did was made a copy of imagemagick.exe in the installation directory (which was c:\Program Files\ImageMagic for me) and renamed the file to identify.exe
Upvotes: 2
Reputation: 106736
ENOENT
means identify
can't be found. Make sure that you have installed ImageMagick and that it is installed in a path that is found in $PATH
.
Upvotes: 9