ol-th / pdf-img-convert.js

Simple node package to convert a PDF into images.
MIT License
161 stars 38 forks source link

Problem with canvas.node #43

Open AhmedAbdalaty opened 1 year ago

AhmedAbdalaty commented 1 year ago

I have a problem running the package on a windows machine and I get this error every time

" node:internal/modules/cjs/loader:1141:19) at require (node:internal/modules/cjs/helpers:110:18) at Object. (...\node_modules\canvas\lib\bindings.js:3:18) at Module._compile (node:internal/modules/cjs/loader:1254:14) at Module._extensions..js (node:internal/modules/cjs/loader:1308:10) at Module.load (node:internal/modules/cjs/loader:1117:32) at Module._load (node:internal/modules/cjs/loader:958:12) { code: 'ERR_DLOPEN_FAILED' }

Node.js v18.16.0 "

fsuk commented 1 year ago

Getting the same issue. Might be related to https://github.com/Automattic/node-canvas/issues/930

fsuk commented 1 year ago

If using sharp in your project make sure to do the following anywhere sharp is imported (in this specific order)

import pdf2img from 'pdf-img-convert'
import { createCanvas } from 'canvas'
import sharp from 'sharp'