ImageMagick和NodeJS的问题

时间:2018-09-20 08:54:08

标签: node.js imagemagick node-imagemagick

我尝试使用NodeJS ImageMagick模块裁剪图像,但是出现错误...

该图像很好地托管在服务器上(使用multerjs),并且thumbnail.path不为空。

我的代码:

im.crop({
  srcPath: thumbnail.path,
  dstPath: thumbnail.path,
  width: 250,
  height: 250,
  format: 'jpg'
}, function(err, stdout, stderr) {

  console.log(err, stdout, stderr);

  if (err) {
    throw err;
  }

  CfcTournamentModel.create(tournament).then(function() {
      request.flash('success', 'added !!');
      response.redirect('/cfc-user/show');
  });
});

错误消息:

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: spawn identify ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gestiaweb@2.0.1 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gestiaweb@2.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\antho\AppData\Roaming\npm-cache\_logs\2018-09-20T08_49_45_774Z-debug.log

0 个答案:

没有答案