electron-builder: compiling with wrong NODE_MODULE_VERSION ?
“electron-builder”: “^20.38.5”,
Windows
I can’t figure this out
node_modules\sqlite3\lib\binding\electron-v4.0-win32-x64\node_sqlite3.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 64. This version of Node.js requires NODE_MODULE_VERSION 69. Please try re-compiling or re-installing the module (for instance, using npm rebuildornpm install).
what is NODE_MODULE_VERSION 69 anyways? electron is 4.0.4 everything else build fines just sqlite3 anyone know how what i can do to fix this? i tested it out with electron-rebuild as whats on the electronjs website and that builds it fine and the electron app works but when i try to build with electron-builder i get that error.
Thanks
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 21
- Comments: 35 (1 by maintainers)
Commits related to this issue
- [WIP] Adding sqlite Trying to add sqlite, but having issues with NODE_MODULE_VERSION Issue found: https://github.com/electron-userland/electron-builder/issues/3660 — committed to ferranDelgado/electron-learning by ferranDelgado 5 years ago
- [WIP] Adding sqlite Trying to add sqlite, but having issues with NODE_MODULE_VERSION Issue found: https://github.com/electron-userland/electron-builder/issues/3660 — committed to ferranDelgado/electron-learning by ferranDelgado 5 years ago
- [WIP] Adding sqlite Trying to add sqlite, but having issues with NODE_MODULE_VERSION Issue found: https://github.com/electron-userland/electron-builder/issues/3660 — committed to ferranDelgado/electron-learning by ferranDelgado 5 years ago
- [WIP] Adding sqlite Trying to add sqlite, but having issues with NODE_MODULE_VERSION Issue found: https://github.com/electron-userland/electron-builder/issues/3660 — committed to ferranDelgado/electron-learning by ferranDelgado 5 years ago
- chore: use new NMV of 69. Refs: https://github.com/nodejs/TSC/issues/651 — committed to electron/node by MarshallOfSound 5 years ago
- Desktop: Updated build process to fix buggy electron-builder https://github.com/electron-userland/electron-builder/issues/3660#issuecomment-465461491 — committed to laurent22/joplin by laurent22 5 years ago
I have checked building the app with following versions and the build is successful
So you can keep everything at its latest version just keep electron at 4.0.3 and your app should build fine! The issue has something to do with specific version of electron i.e. 4.0.4 and electron-builder.
This also works fine for me!
So you can keep everything updated & just in the
buildkey inside your package.json addnpmRebuild:false, make sure that yourpostinstallcontains rebuild command. This will rebuild all the dependencies immediately after downloading packages and when you build your app usingelectron-builderit won’t rebuild again becausenpmRebuildis set to false.The issue is with electron-builder, when it tries to rebuild packages while building app it fails!
So you can either use this comment of mine or this one 😃
I am sure devs will fix this asap till then these are the workarounds 😃
It is not electron-builder problem.
electron-rebuildworks only because it does rebuild, butelectron-builder install-app-depsdoesn’t even try to build your module using some custom solution — all what electron-builder does, — calls appropriate tool (https://www.npmjs.com/package/prebuild or whatever is used by module author) with a proper environment.If native module doesn’t use any prebuild — then no problem regardless of ABI/electron version. Module will be recompiled on your machine.
If native module uses
prebuildor any other such tool to provide prebuilts — then if Electron violates semver policy or for some another reason such tool is not aware about new Electron ABI, you will get such problem (well, it is definitely not expected forprebuildthat changing of patch version will increment ABI version).So, electron-builder cannot handle such errors — we rely on existing tools and I don’t want to reinvent
prebuildor incorporate some hacks. Or Electron should be fixed itself, orprebuild(and if error on Electron side and Electron maintainers don’t want to fix it, then some workaround onprebuildside).I hope that now situation and reasons are clear for everyone.
So, if Electron violates semver policy once again and for now no workaround on
prebuildside, then workaround is simple — just force rebuild using configuration option:(you can also pass as CLI arg:
-c.buildDependenciesFromSource=true)Same issue here with
serialport. Runningelectron-rebuildand/orelectron-builder install-app-depsdoes not work. Even switching back to older electron (4.0.0, 4.0.1) version does not help. Also tried newer and older versions ofserialport. Still no success. Any ideas?Thank you @thevirajshelke! It worked for me.
I explicitly set the
electronVersionof theelectron-builderto4.0.3and indeed, it is working again on macOS and Windows.Thanks for your help
@thevirajshelke This is exactly what I have done as workaround.
So according to Electron maintainers - electron-builder should do something in order to fix the issue with building the native deps.
Yes but that’s not a solution. I didn’t understand the reasoning about switching to non existant node version, specific for electron and its ABI stuff that i don’t understand. When I set npmRebuild to false and perform the sqlite rebuild with electron-rebuild - everything is fine. So the issue must be in that npm rebuild command that electron-builder perform, which breaks sqlite module build.
@phhoef you are totally right, thanks!
Have the same issue after packaging with sqlite3. (stayed on 4.0.3 and all works fine. Hope a solution is found for 4.0.4 soon)
yea like i said mine builds fine with rebuilder and i don’t how to fix it when i use builder