admin管理员组文章数量:1333386
Even though this has been asked several times, none of the existing answers helped me out. Using a MEAN environment (on Mac OSX), I installed graphicsmagick using:
sudo npm install gm
Whenever I run the following script, I get this error:
{ [Error: spawn ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn' }
This is the piece of code I am trying to run:
var gm = require('gm');
//var gm = require('gm').subClass({ imageMagick: true }); //tried this one too
gm('./project/public/images/webshots/test1.jpg')
.resize(320, 240)
.write('./project/public/images/webshots/test2.jpg', function (err) {
if (!err) console.log('done');
if(err){
console.log(err);
}
});
Appropriate writing permissions were given by:
sudo chmod -R 777 ./project/public/images/webshots
I even tried several source/destination path binations. What else could I have missed?
Even though this has been asked several times, none of the existing answers helped me out. Using a MEAN environment (on Mac OSX), I installed graphicsmagick using:
sudo npm install gm
Whenever I run the following script, I get this error:
{ [Error: spawn ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn' }
This is the piece of code I am trying to run:
var gm = require('gm');
//var gm = require('gm').subClass({ imageMagick: true }); //tried this one too
gm('./project/public/images/webshots/test1.jpg')
.resize(320, 240)
.write('./project/public/images/webshots/test2.jpg', function (err) {
if (!err) console.log('done');
if(err){
console.log(err);
}
});
Appropriate writing permissions were given by:
sudo chmod -R 777 ./project/public/images/webshots
I even tried several source/destination path binations. What else could I have missed?
Share Improve this question edited Nov 1, 2014 at 22:18 Igor P. asked Nov 1, 2014 at 22:09 Igor P.Igor P. 1,4773 gold badges22 silver badges37 bronze badges 4-
Did you install imagemagick/graphicsmagick first as noted in the
gm
readme? If so, are you able to execute imagemagick/graphicsmagick manually from the shell prompt? – mscdex Commented Nov 1, 2014 at 22:14 - Yes, both were installed. Sorry for asking but how can I execute it manually? – Igor P. Commented Nov 1, 2014 at 22:37
-
For graphicsmagick it's just
gm
. – mscdex Commented Nov 1, 2014 at 23:35 - No, I can't start it manually. Getting the error: no such mand. Maybe I need to set a PATH? – Igor P. Commented Nov 2, 2014 at 8:57
3 Answers
Reset to default 5It is looking for the gm(GraphicsMagick) binary
Install GraphicsMagick via PPA:
sudo add-apt-repository ppa:dhor/myway
sudo apt-get update
sudo apt-get install graphicsmagick
This worked for me
This helped me solving this issue.
gm('./project/public/images/webshots/test1.jpg')
.options({imageMagick: true})
.resize(320, 240)
.write('./project/public/images/webshots/test2.jpg', function (err) {
if (!err) console.log('done');
if(err){
console.log(err);
}
});
Note: imageMagick should be installed
The gm
module can't find the path to the gm
executable. So it sounds like your $PATH
needs to be updated to include the path where graphicsmagick was installed to.
本文标签: javascriptNodejs Error spawn ENOENT while using GM moduleStack Overflow
版权声明:本文标题:javascript - Node.js: Error: spawn ENOENT while using GM module - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742324748a2453500.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论