【问题标题】:spawn ENOENT error with NodeJS while using gm Module in node JS在节点 JS 中使用 gm 模块时使用 NodeJS 产生 ENOENT 错误
【发布时间】:2016-01-17 22:02:04
【问题描述】:

我在带有 Linux 操作系统的 AWS EC2 实例上使用 gm 节点模块。我的目标是裁剪 S3 存储桶中的 url 提供的图像。我正在对 S3 存储桶中的图像 url 进行 http 请求以获取缓冲区并将缓冲区值传递给 gm 模块。我的代码如下:

  gm(buffer).crop(width, height, x, y).toBuffer(imageExtension, function (err, buffer) {
            if (err) {
               //error Handling
            } else {
              //Some Logic
            }
    });

当我将缓冲区传递给 gm crop 模块时,我得到 spawn ENOENT 错误。

events.js:85
throw err; // Unhandled 'error' event
      ^
Error: spawn convert ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickDomainCallback (node.js:381:11)

我参考了堆栈溢出的以下链接以供参考,但无法修复错误。

  1. Error: spawn ENOENT while using GM in node
  2. Node.js: Error: spawn ENOENT while using GM module
  3. spawn ENOENT error with NodeJS
  4. nodejs - Error: spawn ENOENT while adjusting image size using module gm

有人可以帮我解决这个问题吗?

【问题讨论】:

    标签: node.js amazon-ec2 imagemagick graphicsmagick


    【解决方案1】:

    为了解决这个问题,我参考了以下关于服务器故障的链接

    how to properly set up ImageMagick on AWS server using nodejs and express

    我在 Amazon EC2 实例终端上运行了下面给出的命令,并且在服务器上安装了 linux 架构的依赖项,并且 gm 节点模块开始正常工作。

    sudo yum install GraphicsMagick GraphicsMagick-devel ImageMagick
    

    【讨论】:

      猜你喜欢
      • 2013-04-19
      • 1970-01-01
      • 1970-01-01
      • 2022-08-22
      • 2013-09-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多