Reputation: 71
I packaged my cli application using pkg and it is working fine on macOS but not running on windows and complaining about keytar.node binary. I am using the same keytar.node which i installed on development machine(macOS) to run on windows as well. I am wondering if it is throwing an error because of native node binary being compiled on different os? if that is the case is there any way to use keytar.node cross platform without compiling it on individual os?
Error: //?/C:/Users/alias/bin/keytar.node is not a valid Win32 application.
//?/C:/Users/alias/bin/keytar.node
at Module.require (pkg/prelude/bootstrap.js:1229:31)
at Object.<anonymous> (C:/snapshot/pcas-cli/node_modules/keytar/lib/keytar.js:1:76)
at Module._compile (pkg/prelude/bootstrap.js:1324:22)
Any kind of help would be appreciated. Thanks
Upvotes: 5
Views: 1443
Reputation: 1535
If you're using electron-builder
, make sure to run npx electron-builder install-app-deps --platform=win32 --arch=x64
after npm install
to get the prebuilt Keytar binary for Windows.
Upvotes: 3