Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
375 views
in Technique[技术] by (71.8m points)

node.js - graphicsmagic not installed in google cloud functions?

i m working in a project in firebase that uses graphics magic to convert images to pdf it's working fine in local emulator but doesnt in production

Error: Could not execute GraphicsMagick/ImageMagick: gm "convert" "./0" "./a4.pdf" this most likely means the gm/convert binaries can't be found at ChildProcess. (/workspace/node_modules/gm/lib/command.js:232:12) at ChildProcess.emit (events.js:198:13) at ChildProcess.EventEmitter.emit (domain.js:448:20) at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12) at onErrorNT (internal/child_process.js:415:16) at process._tickCallback (internal/process/next_tick.js:63:19)

knowing that in the cloud functions documentation they said that graphics magic is included in the environement see : https://cloud.google.com/functions/docs/tutorials/imagemagick

Edit : gm requires installation (apt get install), i can't do that in cloud functions , cuz i dont have access to the machine. i'm working now with pdfkit, its does the same job and doesnt require installation (requires npm install tho)

question from:https://stackoverflow.com/questions/65602524/graphicsmagic-not-installed-in-google-cloud-functions

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You are supposed to include gm on your dependencies. You can do so by running:

npm install gm

And have your dependencies look like:

"dependencies": {
  "@google-cloud/storage": "^5.0.0",
  "@google-cloud/vision": "^2.0.0",
  "gm": "^1.23.1"
}

I just followed this documentation and it's working fine on Nodejs10 runtime.

UPDATE: It looks like there's an open issue on GitHub about this problem. I suggest you put a comment in there and provide detailed information similar to what the reporter did.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...