在节点JS中使用gm模块时,与NodeJS产生ENOENT错误

时间:2022-11-19 14:39:24

I am using gm node module on AWS EC2 Instance with a Linux OS. My Aim to crop the image provided by the url from the S3 bucket.I am doing http request to the image url from the S3 bucket to get the buffer and passing the buffer value to the gm module. My Code is as follows:

我在AWS EC2实例上使用gm节点模块和Linux操作系统。我的目标是裁剪来自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
            }
    });

When I pass the buffer to the gm crop module , I get spawn ENOENT error.

当我将缓冲区传递给gm裁剪模块时,我会产生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)

I referred to following links on stack overflow for reference but couldn't fix the error.

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

  1. Error: spawn ENOENT while using GM in node
  2. 错误:在节点中使用GM时生成ENOENT

  3. Node.js: Error: spawn ENOENT while using GM module
  4. Node.js:错误:使用GM模块时生成ENOENT

  5. spawn ENOENT error with NodeJS
  6. 与NodeJS产生ENOENT错误

  7. nodejs - Error: spawn ENOENT while adjusting image size using module gm
  8. nodejs - 错误:使用模块gm调整图像大小时生成ENOENT

Can Somebody help me with this issue?

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

1 个解决方案

#1


2  

To Resolve this issue I referred to the following link on server fault

要解决此问题,我在服务器故障上引用了以下链接

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

如何使用nodejs和express在AWS服务器上正确设置ImageMagick

I Ran the command given below on the Amazon EC2 instance terminal and the dependencies for the linux architecture was installed on the server and gm node module started working properly.

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

sudo yum install GraphicsMagick GraphicsMagick-devel ImageMagick

#1


2  

To Resolve this issue I referred to the following link on server fault

要解决此问题,我在服务器故障上引用了以下链接

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

如何使用nodejs和express在AWS服务器上正确设置ImageMagick

I Ran the command given below on the Amazon EC2 instance terminal and the dependencies for the linux architecture was installed on the server and gm node module started working properly.

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

sudo yum install GraphicsMagick GraphicsMagick-devel ImageMagick