node.jsexpressgm

Error: Could not execute GraphicsMagick/ImageMagick: identify "-ping" "-format" "%wx%h"


I'm trying to find the dimensions of the images in a production machine.It returns error.

Could not execute GraphicsMagick/ImageMagick: identify "-ping" "-format" "%wx%h" "uploads/userPhoto-1499669685192.png" this most likely means the gm/convert binaries can't be foundsize==undefined

But it is working fine in local machine and I have already uploaded modules in production machine which are same as local machine.


Solution

  • According to source code for gm, this error happens when spawn (function to start a process) returns ENOENT, which is the low-level error for "no entry", meaning the required program was not found in $PATH for the running node process (I mean it might be present but you still need to check environment of running process).

    So it is a simple installation issue of the required components. Local machine has all af them, but not your production machine. You said you have "already uploaded all modules" (I think you mean all npm modules), but that is not enough, the gm module relies on one of GraphicsMagick or ImageMagick.

    Quote from main page for gm:

    First download and install GraphicsMagick or ImageMagick.