k-yle / pdf-to-img

📃📸 Converts PDFs to images in nodejs
https://npm.im/pdf-to-img
MIT License
84 stars 22 forks source link

Update canvas version #225

Closed Adi1231234 closed 1 year ago

Adi1231234 commented 1 year ago

hi! I want to use this library in electron, but there is a problem with it when I try to run electron-rebuild. I saw this PR - https://github.com/Automattic/node-canvas/pull/2235 and I think it might help. I would love to hear your opinon.

The error:

> rebuild
> electron-rebuild --parallel --types prod,dev,optional --module-dir release/app

\ Building modules: 1/2Warning: Missing input files:
C:\GTK\bin\libpango-1.0-0.dll
C:\GTK\bin\zlib1.dll
C:\GTK\bin\libpangoft2-1.0-0.dll
C:\GTK\bin\libintl-8.dll
C:\GTK\bin\libpangocairo-1.0-0.dll
C:\GTK\bin\libfreetype-6.dll
C:\GTK\bin\libgthread-2.0-0.dll
C:\GTK\bin\libpng14-14.dll
C:\GTK\bin\libfontconfig-1.dll
C:\GTK\bin\libglib-2.0-0.dll
C:\GTK\bin\libpangowin32-1.0-0.dll
C:\GTK\bin\libgmodule-2.0-0.dll
C:\GTK\bin\libcairo-2.dll
C:\GTK\bin\libgobject-2.0-0.dll
C:\GTK\bin\libexpat-1.dll
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
  Backend.cc
C:\Users\app\node_modules\canvas\src\backend\Backend.h(3,10): fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory [C:\software\release\app\node_modules\canvas\build\canvas.vcxproj]
Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
    at ChildProcess.onExit (C:\software\node_modules\node-gyp\lib\build.js:203:23)
    at ChildProcess.emit (node:events:390:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)

× Rebuild Failed

An unhandled error occurred inside electron-rebuild
node-gyp failed to rebuild C:\software\release\app\node_modules\canvas'

Error: node-gyp failed to rebuild C:\software\release\app\node_modules\canvas'
    at ChildProcess.<anonymous> (C:\software\node_modules\@electron\rebuild\lib\module-type\node-gyp\node-gyp.js:118:24)
    at ChildProcess.emit (node:events:390:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)

Thanks!

k-yle commented 1 year ago

I've released v2.1.2 which depends on the latest canvas version (v2.11.2).

Going forward I don't think we need to pin dependencies anymore. I'll do another update in the future to be more flexible about dependency versions

Adi1231234 commented 1 year ago

Sorry, I thought they released new version with this feature. The idea of the flexibility sounds amazing! Thank!