Sharp: The specified module could not be found, with electron, again

Created on 30 Mar 2019  路  4Comments  路  Source: lovell/sharp

It seems to be unrelated to #1522.
What I have:

  • windows 8 x64
  • electron 4.1.0
  • sharp 0.22.0

I did yarn add sharp and yarn electron-rebuild and it ran successfully. But I had this error:
Error: The specified module could not be found. .... node_modules\sharp\build\Release\sharp.node

After I manually copied all *.dll files from sharp/vendor/lib folder to sharp/build/Release the error went away.

Did I miss some step in installation? Why weren't those files copied automatically?

question

Most helpful comment

The current install script copies the DLLs:

https://github.com/lovell/sharp/blob/fc178de309d8e4055e86ffe1bbcfcf40754c885b/package.json#L65

If electron-rebuild doesn't run this then perhaps you'll need to manually do this afterwards:

node node_modules/sharp/install/dll-copy

All 4 comments

Precompiled binaries are not yet provided for Electron 4 - see #1522.

Please can you provide the debug/verbose output of running electron-rebuild.

Oh, now I see. I looked more carefully at sharp/build/Release folder. When I do just yarn add sharp without rebuilding, those dlls are inside that folder, but I have an error about ABI version mismatch. And when I run electron-rebuild, it rebuilds only libvips-cpp.dll and does not copy other dlls from vendor.

I don't know about building process for node, but I think we could add a post-build event that would copy dlls into the right place to automate the process.

Btw, I didn't find verbose option for electron-rebuild (there is undocumented --log switch, but it doesn't work for me).

The current install script copies the DLLs:

https://github.com/lovell/sharp/blob/fc178de309d8e4055e86ffe1bbcfcf40754c885b/package.json#L65

If electron-rebuild doesn't run this then perhaps you'll need to manually do this afterwards:

node node_modules/sharp/install/dll-copy

So, the problem may be in electron-rebuild. Ok, thanks for the explanation.

Was this page helpful?
0 / 5 - 0 ratings