Sharp w/ Electron not loading (electron-forge)
See original GitHub issueProblem:
I’m trying to use sharp w/ electron.
Everything (sharp+electron) is working in OSX.
On Windows (using gitbash), I’m able to use sharp globally installed with a simple node.js test, but not in electron.
As soon as I uncomment
const sharp = require('sharp');
the app white-screens and doesn’t load (no further errors / hints / direction).
Install Sharp installs w/o errors: verbose output from fresh install: link non-verbose:
$ npm i --save sharp
sharp@0.23.2 install C:\Users\andrew\code\js\electron\spec-electron\node_modules\sharp (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.8.1/libvips-8.8.1-win32-x64.tar.gz info sharp Creating C:\Users\andrew\code\js\electron\spec-electron\node_modules\sharp\build\Release info sharp Copying DLLs from C:\Users\andrew\code\js\electron\spec-electron\node_modules\sharp\vendor\lib to C:\Users\andrew\code\js\electron\spec-electron\node_modules\sharp\build\Release
- sharp@0.23.2 added 13 packages from 65 contributors and audited 14365 packages in 21.978s found 20 vulnerabilities (5 low, 8 moderate, 6 high, 1 critical) run
npm audit fix
to fix them, ornpm audit
for details
Environment:
$ npx envinfo --binaries --languages --system – utilities npx: installed 1 in 1.828s
System: OS: Windows 10 CPU: (2) x64 Intel® Core™ i7-6820HQ CPU @ 2.70GHz Memory: 3.40 GB / 7.10 GB Binaries: Node: 12.4.0 - C:\Program Files\nodejs\node.EXE npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD Languages: Bash: 4.4.23 - C:\Program Files\Git\usr\bin\bash.EXE Perl: 5.26.2 - C:\Program Files\Git\usr\bin\perl.EXE Python: 2.7.17 - C:\Python27\python.EXE
Similar question:
This is very similar to #1846, but the suggested solutions aren’t working:
Attempting solution from @lovell :
andrew@ANDREWT0C72 MINGW64 ~/code/js/electron/spec-electron (windows10) $ ./node_modules/.bin/electron-rebuild
- Searching dependency tree √ Rebuild Complete
but problem persists
Attempting solution from Mubaidr:
$ ./node_modules/.bin/electron-builder install-app-deps • electron-builder version=22.1.0 • rebuilding native dependencies dependencies=@serialport/bindings@8.0.4, sharp@0.23.2 platform=win32 arch=x64 • install prebuilt binary name=@serialport/bindings version=8.0.4 platform=win32 arch=x64 • build native dependency from sources name=@serialport/bindings version=8.0.4 platform=win32 arch=x64 reason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information) error=prebuild-install info begin Prebuild-install version 5.3.3 prebuild-install WARN install prebuilt binaries enforced with --force! prebuild-install WARN install prebuilt binaries may be out of date! prebuild-install info looking for cached prebuild @ C:\Users\andrew\AppData\Roaming\npm-cache_prebuilds\afca11-bindings-v8.0.4-electron-v73-win32-x64.tar.gz prebuild-install http request GET https://github.com/serialport/node-serialport/releases/download/v8.0.4/bindings-v8.0.4-electron-v73-win32-x64.tar.gz prebuild-install http 404 https://github.com/serialport/node-serialport/releases/download/v8.0.4/bindings-v8.0.4-electron-v73-win32-x64.tar.gz prebuild-install WARN install No prebuilt binaries found (target=6.1.4 runtime=electron arch=x64 libc= platform=win32)
• install prebuilt binary name=sharp version=0.23.2 platform=win32 arch=x64
despite error on prebuild install for serialport - serial port still ends up working, uncommenting sharp still causes the app to fail to load.
I’m getting no errors out in the main console, nor in chrome tools console - so I’m grabbing at straws / looking for any ideas on what else I can try.
Issue Analytics
- State:
- Created 4 years ago
- Comments:16 (2 by maintainers)
@andrewrt any update on this? I’m facing the same issue
@Cosmin-Parvulescu This electron-forge project I am working on is only meant to run on Windows and Linux (and Mac OS eventually). So far, I tested the packaged application on both Windows x64 and WSL 2 Ubuntu (WSLg), and I can confirm that my approach - copying
sharp
and its dependencies manually - does work on these platforms.But I don’t know if it would work on Android.