electron-builder installer: A JavaScript error occurred in the main process, Error: The specified module could not be found

Viewed 1807

I am using electron 11.1.0 and electron-builder 22.10.5

I created a installer for my electron app which is using native module using electron-builder and its working fine on my laptop but on my friends laptop I am getting error

A JavaScript error occurred in the main process

Uncaught Exception:
Error: The specified module could not be found.
\\?C:\some\path\My-Electron-App\resources\app.asar.unpacked\node_modules\obs-studio-node\obs_studio_client.node

I have checked C:\some\path\My-Electron-App\resources\app.asar.unpacked\node_modules\obs-studio-node\obs_studio_client.node file exists.

I guess its asar related issue with native module. I tried by adding "asarUnpack": ["**/*.node"] in my build config but does not help.

How can I fix this problem?

1 Answers

I could not get this working with asarUnpack. Instead I use

"asar": false

Increases the bundle size, but at least it works.

Related