-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Electron on Windows: The specified module could not be found #2764
Comments
Hi, does this still happen if you remove the |
It does, and I removed the module. The issue is (somewhat) resolved in the https://github.com/ivancuric/native-repro-sharp/tree/forge-hook-hack branch. What I needed to do is run This is done before each app run in the forge config: generateAssets: async () => {
return new Promise((resolve, reject) => {
const npmInstall = spawn('yarn', ['fix-sharp'], {
stdio: 'inherit',
shell: true,
});
npmInstall.on('close', (code) => {
if (code === 0) {
resolve();
} else {
reject(new Error('process finished with error code ' + code));
}
});
npmInstall.on('error', (error) => {
reject(error);
});
});
}, |
Thanks, it looks like you're affected by electron/rebuild#520 sharp provides prebuilt binaries based on Node-API (N-API) that are designed to "just work" with all supported versions of Node.js and Electron, but |
Thanks for the input, gonna see if I can forward this issue! |
I've heard from other sharp+Electron users (there are many) that |
Thanks, I'll check it out.
…On Tue, Jun 29, 2021, 10:36 Lovell Fuller ***@***.***> wrote:
I've heard from other sharp+Electron users (there are many) that
electron-builder provides better support for Node-API based modules than
electron-forge, so that might be worth investigating too.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2764 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVSGJ56LLPFYAERWD6HSRDTVGAXDANCNFSM47FSYDUA>
.
|
@lovell i'm having the same problem with electron-builder with asar enabled. |
I've been looking into this more and I'm working on a fix for the above mentioned issue with However, if loading a prebuilt binary fails, @ivancuric reports this which appears to suggest he has a similar result:
Is I've tried |
@timfish Thank you for working on a fix for this. sharp can be built from source and should work, but for Windows note the DLL-copying command that runs as part of Line 83 in 7467fa8
I took a quick look at your PR. Perhaps running electron-rebuild should be a "no-op" when using Node-API as the existing file(s) already in place will work? |
There is also the issue that there's no easy way to detect if a module uses Node-API. There's Whereas the node ecosystem relies on install scripts to copy binaries with the platform and arch swapped via environment variables, |
The use of |
The reason for this error may be the .node file cannot find its required .dll files. |
v0.33.0 is now available and no longer depends on |
Reproduction repo: https://github.com/ivancuric/native-repro-sharp
In this repo I am using 3 different native modules: an included one built with cmake (
video-module
), a dummy native module (native-hello-world
), andsharp
. I am running this on Windows 10.Sharp is the only module that throws an error after the initial installation and build on
yarn start
, even though the module is present at the location:Removing
node_modules/sharp
doesn't help. What does help is runningyarn install --force
an additional time.You can see the difference in the
node_modules/sharp
directory between the initial and second installation here:https://editor.mergely.com/3aNte8dC/
What could be causing this? Seems that the
install
script in sharp'spackage.json
isn't being run properly because running it manually afterwards from thenode_modules
directory works fine.On the branch
forge-hook-hack
, I am runningnode node_modules/sharp/install/dll-copy
after every rebuild:The text was updated successfully, but these errors were encountered: