0
我得到「處理‘錯誤’事件」,而運行一飲而盡:咕嘟咕嘟未處理的「錯誤」事件
events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn gm 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:437:9)
at process._tickCallback (node.js:351:17)
我發現錯誤由我gulpfile.js該功能引起的:
var taskResizeSprite2x = function() {
return gulp.src(config.paths.source.sprite + '/*@2x.png')
.pipe(changed(config.paths.source.sprite + '/*@2x.png'))
.pipe(gm(function(gmfile) {
gmfile.size(function(err, value) {
if(value && (value.width % 2 !== 0 || value.height % 2 !== 0)) {
var src = gmfile.name().source;
modules.livereload.notify('Retina images must have even size!<br>' + src);
throw Error('Retina images must have even size! ' + src);
}
})
return gmfile.resize('50%', '50%');
}))
.pipe(rename(function(filepath) {
filepath.basename = filepath.basename.replace(/@\dx/, '');
}))
.pipe(gulp.dest(config.paths.source.sprite));
};
我應該做什麼以及如何調試它發生的原因?