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

Can not be used in ia32 packaged application #6

Closed
GrumpyCrouton opened this issue Mar 12, 2019 · 4 comments
Closed

Can not be used in ia32 packaged application #6

GrumpyCrouton opened this issue Mar 12, 2019 · 4 comments

Comments

@GrumpyCrouton
Copy link

When trying to use this module in an Electron application which is packaged as ia32 (32bit), I get the following error

Uncaught Error: \\?\F:\edc\v2\32bit\resources\app\node_modules\win-audio\build\Release\audio.node is not a valid Win32 application.
\\?\F:\edc\v2\32bit\resources\app\node_modules\win-audio\build\Release\audio.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:160:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:722)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:160:31)
    at Module.load (internal/modules/cjs/loader.js:602)
    at tryModuleLoad (internal/modules/cjs/loader.js:541)
    at Function.Module._load (internal/modules/cjs/loader.js:533)
    at Module.require (internal/modules/cjs/loader.js:640)
    at require (internal/modules/cjs/helpers.js:20)
    at Object.<anonymous> (F:\edc\v2\32bit\resources\app\node_modules\win-audio\dist\index.js:5)
    at Object.<anonymous> (F:\edc\v2\32bit\resources\app\node_modules\win-audio\dist\index.js:139)
    at Module._compile (internal/modules/cjs/loader.js:693)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:704)
    at Module.load (internal/modules/cjs/loader.js:602)
    at tryModuleLoad (internal/modules/cjs/loader.js:541)
    at Function.Module._load (internal/modules/cjs/loader.js:533)
    at Module.require (internal/modules/cjs/loader.js:640)
@fcannizzaro
Copy link
Owner

fcannizzaro commented Mar 13, 2019

you can run

npx electron-rebuild . --arch=ia32

to rebuild native module to 32 bit arch, before run the packager.

@GrumpyCrouton
Copy link
Author

I'll try this and let you know my results.

@GrumpyCrouton
Copy link
Author

GrumpyCrouton commented Mar 14, 2019

Great, I got this to work with your help. However, now if it runs using x64 architecture, I get the original error as above. Is there any way to make it work on both x64 and ia32?

For now, I just added the rebuild command to my scripts, but I'd like to avoid that.

"scripts": {
    "start": "npx electron-rebuild . --arch=x64 && electron .",
    "compile64": "npx electron-rebuild . --arch=x64 && electron-packager . --overwrite",
    "compile32": "npx electron-rebuild . --arch=ia32 && electron-packager . --arch=ia32 --overwrite",
    "compile-all": "npm run compile64 && npm run compile32"
  },

@fcannizzaro
Copy link
Owner

I believe there is no way to build for 32/64 bit at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants