亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

找不到 gm/convert 二進制文件 Node.js pdf 到圖像的轉換

找不到 gm/convert 二進制文件 Node.js pdf 到圖像的轉換

呼如林 2022-12-09 13:58:21
我正在使用https://www.npmjs.com/package/pdf2pic將我的 PDF 轉換為圖像。const PDF2Pic = require('pdf2pic');const pdf2pic = new PDF2Pic({  density: 100, // output pixels per inch  savename: 'untitled', // output file name  savedir: './images', // output file location  format: 'png', // output file format  size: '600x600', // output size in pixels});const file = "/Users/kar1/Downloads/bw.pdf"async function recognizeFile(file) {  pdf2pic.convertBulk(file, -1).then((resolve) => {    console.log('image converter successfully!');    return resolve;  });}recognizeFile(file)錯誤 :(node:32605) UnhandledPromiseRejectionWarning: Error: Could not execute GraphicsMagick/ImageMagick: gm "identify" "-ping" "-format" "%p" "/Users/kar1/Downloads/bw.pdf" this most likely means the gm/convert binaries can't be found    at ChildProcess.<anonymous> (/Users/kar1/Desktop/github/pdfToPic/node_modules/gm/lib/command.js:232:12)    at ChildProcess.emit (events.js:315:20)    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)    at onErrorNT (internal/child_process.js:469:16)    at processTicksAndRejections (internal/process/task_queues.js:84:21)我試過了 :brew install imagemagick而且這個問題仍然存在。我該如何解決這個問題?
查看完整描述

1 回答

?
瀟湘沐

TA貢獻1816條經驗 獲得超6個贊

通過運行這些命令解決了問題:


brew install imagemagick

brew install gs


查看完整回答
反對 回復 2022-12-09
  • 1 回答
  • 0 關注
  • 82 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號