Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to use ImageMagick when testing locally run Firebase functions

I am testing a function locally using Firebase functions shell.

The function I am testing is the example storage trigger to generate a thumbnail image found here.

The functions runs fine in production. When i run the function locally, I receive the following error message:

Error: spawn convert ENOENT
at _errnoException (util.js:999:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19)
at onErrorNT (internal/child_process.js:389:16)
at process._tickCallback (internal/process/next_tick.js:152:19)

As far as I can tell the spawn command can't find "convert" which relates to ImageMagick. I am aware that ImageMagick is installed by default with Firebase functions but it doesn't appear to be available while testing locally.

Is there some way to run the Firebase functions shell with access to ImageMagick?


1 Answers

ImageMagick is installed by default on Cloud Functions servers for you to use when your functions are deployed, but it is not installed along with the Firebase CLI and the SDK that you download locally to your machine.

You'll need to install ImageMagick on your machine, and make sure its convert command is in your PATH before you run the emulator. This works fine for me.

like image 121
Doug Stevenson Avatar answered Oct 29 '25 21:10

Doug Stevenson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!