Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The specified module could not be found, with electron v4.0.0. #1522

Closed
iacovlev-pavel opened this issue Dec 24, 2018 · 32 comments
Closed

The specified module could not be found, with electron v4.0.0. #1522

iacovlev-pavel opened this issue Dec 24, 2018 · 32 comments

Comments

@iacovlev-pavel
Copy link

@iacovlev-pavel iacovlev-pavel commented Dec 24, 2018

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.

@lovell

This comment has been minimized.

Copy link
Owner

@lovell lovell commented Dec 26, 2018

The target flag passed to node-gyp refers to the version of Node rather than the version of Electron.

You'll probably want to use electron-rebuild.

@lovell lovell added the question label Dec 26, 2018
@iacovlev-pavel

This comment has been minimized.

Copy link
Author

@iacovlev-pavel iacovlev-pavel commented Dec 27, 2018

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-url is set to https://atom.io/download/electron

@lovell

This comment has been minimized.

Copy link
Owner

@lovell lovell commented Dec 28, 2018

Is this on Windows? If so, try pointing Dependency Walker at the sharp.node file to help determine which shared library might be causing the problem.

@ddding

This comment has been minimized.

Copy link

@ddding ddding commented Dec 29, 2018

sharp.zip
I have the same issue and here is my Dependency Walker file.

@lovell

This comment has been minimized.

Copy link
Owner

@lovell lovell commented Dec 29, 2018

Thanks, according to that .dwi file the missing shared library is node.dll so I guess either something changed in the way Electron 4 provides/packages this and/or electron-rebuild does not yet support it.

I'd imagine other native modules are going to fail in a similar manner - please can you report this downstream.

@lovell

This comment has been minimized.

Copy link
Owner

@lovell lovell commented Dec 29, 2018

"However, in Electron 4.x and higher, the symbols needed by native modules are exported by electron.exe, and there is no node.dll in Electron 4.x."

https://electronjs.org/docs/tutorial/using-native-node-modules#troubleshooting

@ddding

This comment has been minimized.

Copy link

@ddding ddding commented Dec 30, 2018

Thank you, but I still don't understand how to make things right, or maybe I should just wait for electron-rebuild to release some update?

@lovell

This comment has been minimized.

Copy link
Owner

@lovell lovell commented Jan 6, 2019

Please can someone confirm that this problem is limited to Windows only. Is anyone able to produce a minimal repo that exhibits the problem?

@groboter

This comment has been minimized.

Copy link

@groboter groboter commented Jan 6, 2019

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.

@lovell

This comment has been minimized.

Copy link
Owner

@lovell lovell commented Jan 8, 2019

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-rebuild it calls prebuild-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-install before running electron-rebuild.

npm install
rm -rf node_modules/prebuild-install
./node_modules/.bin/electron-rebuild

In summary, Electron needs to sort out its ABI versioning.

@lovell

This comment has been minimized.

Copy link
Owner

@lovell lovell commented Jan 9, 2019

Here's confirmation of the Electron 3 vs 4 ABI incompatibility - lgeiger/node-abi#55 (comment) - this will impact all native modules that provide prebuilt binaries for Electron.

@iacovlev-pavel

This comment has been minimized.

Copy link
Author

@iacovlev-pavel iacovlev-pavel commented Jan 9, 2019

@lovell Thank you for clarification and for such an awesome library in general.

@midevnull

This comment has been minimized.

Copy link

@midevnull midevnull commented Feb 22, 2019

electron/electron#16687 Am I correct that this should fix the issue?
But I am still getting an error when building with electron-builder on mac.

pp threw an error during load
Error: The module '//node_modules/sharp/build/Release/sharp.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 69. Please try re-compiling or re-installing
the module (for instance, using npm rebuild or npm install).
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:160:31)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:722:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:160:31)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (internal/modules/cjs/loader.js:640:17)
at require (internal/modules/cjs/helpers.js:20:18)
at bindings (/
/node_modules/sharp/node_modules/bindings/bindings.js:112:48)
at Object. (/*/node_modules/sharp/lib/constructor.js:10:34)

This is probably an electron-builder issue and not a sharp one.

@lovell

This comment has been minimized.

Copy link
Owner

@lovell lovell commented Feb 22, 2019

@lovell lovell added this to the v0.22.0 milestone Mar 10, 2019
@xland

This comment has been minimized.

Copy link

@xland xland commented Mar 14, 2019

Electron 4.1.0 seems to have solved this issue, is it?

Electron 4.1.0 was released to work around issues users were experiencing with node-pre-gyp based native modules and our ABI number in Electron >= 4.0.4.

Fixed a crash when calling ECDH.setPrivateKey(). #17297
TouchBarSegmentedControl instances now correctly update when you update the segments array and remove label or image dynamically. #17335
https://electronjs.org/releases/stable#4.1.0

@tomaschyly

This comment has been minimized.

Copy link

@tomaschyly tomaschyly commented Mar 14, 2019

I tried just Electron v4.1.0, but in my case it did not help. Gonna have to wait for sharp update.

@mceachen

This comment has been minimized.

Copy link
Contributor

@mceachen mceachen commented Mar 14, 2019

I tried just Electron v4.1.0, but in my case it did not help. Gonna have to wait for sharp update.

@tomaschyly: Did you clean your build machine? I had to not only delete my project's node_modules, but

rm -rf ~/.electron ~/.electron-gyp ~/.npm/_libvips* ~/.node-gyp ~/.cache/yarn/*/*sharp*

(I added it as postinstall script)

@tomaschyly

This comment has been minimized.

Copy link

@tomaschyly tomaschyly commented Mar 15, 2019

Yes I did try to clean everything, but it seems that I will have to wait for update like I have been told here #1608

@lovell

This comment has been minimized.

Copy link
Owner

@lovell lovell commented Mar 19, 2019

The ABI version of 69 used by Electron 4 is (correctly) considered "oddball" by the prebuild infrastructure so this is still blocked until the approach proposed in prebuild/prebuild-ci#11 is addressed.

@lovell lovell removed this from the v0.22.0 milestone Mar 19, 2019
@JakeRadMSFT

This comment has been minimized.

Copy link

@JakeRadMSFT JakeRadMSFT commented Mar 21, 2019

What is the workaround for this? Using Electron 3?

@xland

This comment has been minimized.

Copy link

@xland xland commented Mar 21, 2019

@JakeRadMSFT

Yes, I have rolled back to Electron 3.1.6(The last version of 3.x.x)

@JakeRadMSFT

This comment has been minimized.

Copy link

@JakeRadMSFT JakeRadMSFT commented Mar 21, 2019

@xland have you gotten it to work after packaging it?

With 3.1.6, I'm hitting this issue: #1519.

@xland

This comment has been minimized.

Copy link

@xland xland commented Mar 21, 2019

@JakeRadMSFT
Electron 3.1.6 and sharp 0.21.3 work well together on macOS, Win10 and Ubuntu

https://github.com/xland/xiangxuema

@inukshuk

This comment has been minimized.

Copy link

@inukshuk inukshuk commented Mar 22, 2019

I think everything already works with Electron 4.1.

I originally run into this same issue, but then I realized that npm update --depth 9999 did not update sharp's sub-dependencies and I was stuck on older versions of prebuild-install and node-abi. Having updated those and also node-gyp globally sharp 0.21.3 works for me on Electron 4.1.

Screenshot from 2019-03-22 09-39-58

I'm having unrelated issues with 0.22 / libvips 8.7.4 on Ubuntu Xenial (because of older versions of librsvg or cairo, not sure yet) but on newer Linux systems I had that combination working as well.

@JakeRadMSFT

This comment has been minimized.

Copy link

@JakeRadMSFT JakeRadMSFT commented Mar 22, 2019

Fixed my issue on Mac (Mac works with Electron 4.1). See #1519

One windows, I still get "Error: The specified module could not be found".

Now trying a downgrade to 3.1.6.

Update:

Doesn't work with 3.1.6. Perhaps I'm hitting some other issue?

@JakeRadMSFT

This comment has been minimized.

Copy link

@JakeRadMSFT JakeRadMSFT commented Mar 22, 2019

Sigh ... it's because of this: mapbox/node-pre-gyp#278

soon to be fixed: mapbox/node-pre-gyp#279

@lovell

This comment has been minimized.

Copy link
Owner

@lovell lovell commented Mar 22, 2019

Should anyone want to speed all this along, the best thing to do would be to work on prebuild/prebuild-ci#11 and ensure ABI version 69 is added to the "oddball" list. Without this a prebuilt sharp will not be available for Electron 4 / ABI 69.

@JakeRadMSFT

This comment has been minimized.

Copy link

@JakeRadMSFT JakeRadMSFT commented Mar 22, 2019

That's actually not the issue anymore ... I think it works against 4. I'll open a new bug ...

@barakman

This comment has been minimized.

Copy link

@barakman barakman commented Mar 28, 2019

Encountered a similar issue with web3 and electron.

Posted an MVP at electron/electron-quick-start#269.

@lovell

This comment has been minimized.

Copy link
Owner

@lovell lovell commented Apr 7, 2019

I've opened a PR to help ensure prebuilt binaries for the latest Electron 4 / ABI 69 will soon be available - see prebuild/prebuild-ci#16

@lovell

This comment has been minimized.

Copy link
Owner

@lovell lovell commented Apr 25, 2019

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),

@lovell lovell closed this Apr 25, 2019
@xland

This comment has been minimized.

Copy link

@xland xland commented Aug 8, 2019

This issue occur on electron 6.0.1.
@lovell

electron-rebuild -f -w sharp

- Searching dependency tree
An unhandled error occurred inside electron-rebuild
Could not detect abi for version 6.0.1 and runtime electron.  Updating "node-abi" might help solve this issue if it is a new release of electron

Error: Could not detect abi for version 6.0.1 and runtime electron.  Updating "node-abi" might help solve this issue if it is a new release of electron
    at Object.getAbi (D:\project\xiangxuema\node_modules\node-abi\index.js:30:9)
    at new Rebuilder (D:\project\xiangxuema\node_modules\electron-rebuild\lib\src\rebuild.js:122:28)
    at rebuildWithOptions (D:\project\xiangxuema\node_modules\electron-rebuild\lib\src\rebuild.js:393:23)
    at Object.doRebuild [as rebuild] (D:\project\xiangxuema\node_modules\electron-rebuild\lib\src\rebuild.js:400:16)
    at Object.<anonymous> (D:\project\xiangxuema\node_modules\electron-rebuild\lib\src\cli.js:115:33)
    at Generator.next (<anonymous>)
    at fulfilled (D:\project\xiangxuema\node_modules\electron-rebuild\lib\src\cli.js:5:58)
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! xiangxuema@6.4.3 buildsharp: `electron-rebuild -f -w sharp`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the xiangxuema@6.4.3 buildsharp script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\allen\AppData\Roaming\npm-cache\_logs\2019-08-08T14_07_46_362Z-debug.log
Repository owner locked and limited conversation to collaborators Aug 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
You can’t perform that action at this time.