sharp: The specified module could not be found, with electron v4.0.0.
With electron 3.0.12 everything seems to work fine.
Changed version to 4.0.0, removed node_modules, did npm i, all ok.
If I run electron-rebuild, the command runs, but it does not rebuild the sharp module, does not seem it’s picking it up.
If I run require('sharp') I get:
The specified module could not be found
If I cd to node_modules/sharp and try to recompile it manually:
node-gyp rebuild --target=4.0.0 --arch=x64 --dist-url=https://atom.io/download/electron
and try require('sharp') I still get The specified module could not be found.
Note: I have checked and sharp.node is present at the specified path.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 32 (13 by maintainers)
v0.22.1 now available with prebuilt binaries for Electron 4 and 5.
Please remember to run
electron-rebuild(which may itself also need updating to pick up the new ABI versions),I’ve opened a PR to help ensure prebuilt binaries for the latest Electron 4 / ABI 69 will soon be available - see https://github.com/prebuild/prebuild-ci/pull/16
The version of Node in Electron 3 does not appear to maintain ABI compatibility with the version in Electron 4 despite both claiming to provide ABI version 64.
When you run
electron-rebuildit callsprebuild-install, which correctly reports that it has a prebuilt binary for Electron with Node ABI version 64. However this binary fails with Electron 4 due to a change in Node ABI without a corresponding version increment.You can hack your way around this by removing
prebuild-installbefore runningelectron-rebuild.In summary, Electron needs to sort out its ABI versioning.
Here’s confirmation of the Electron 3 vs 4 ABI incompatibility - https://github.com/lgeiger/node-abi/pull/55#issuecomment-452588421 - this will impact all native modules that provide prebuilt binaries for Electron.
I have placed a very simple repo which exhibits the problem here https://github.com/groboter/sharpErrorTestApp. I hope it is ok, because it is my first one!
Basically it is just the Quick-Start-App from https://github.com/electron/electron-quick-start and I just added line 3
const {sharp} = require('sharp')which produces the error.@midevnull https://github.com/electron-userland/electron-builder/issues/3660
electron-rebuild is what I am currently using with Electron 3, but it fails with Electron 4. And by fail I mean it does nothing, it just skips the sharp package, that’s why I tried manually with
node-gyp.From what I understand the version is for electron since
dist-urlis set tohttps://atom.io/download/electron