Context: I am building an electron app, which is querying a sql server (remote server) to get the data from table. I am using mssqlnodev8.
Error: When I start the electron app using npm start, I get the below error -
Uncaught Error: None of the binaries loaded successfully. Is your node version either latest 4, 5, 6, 7, 8 or 9 ? at failIfNoBinaryExported (C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:63) at Object.liveLoad (C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:50) at Object. (C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:79) at Object. (C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:81) at Module._compile (internal/modules/cjs/loader.js:711) at Object.Module._extensions..js (internal/modules/cjs/loader.js:722) at Module.load (internal/modules/cjs/loader.js:620) at tryModuleLoad (internal/modules/cjs/loader.js:559) at Function.Module._load (internal/modules/cjs/loader.js:551) at Module.require (internal/modules/cjs/loader.js:658)
Additional information about electron app - I am using bootstrap for my UI. As per electron faq site, I have the below code in my entry html file
<script>
window.nodeRequire = require;
delete window.require;
delete window.exports;
delete window.module;
</script>
All the modules except electron (index.js - entry point) is imported with
nodeRequire
Analysis done till now -
- The javascript logic to connect to database and fetch records are in separate js file. When I execute the file with 'node file.js', it works perfectly fine and returns records.
- The node version is v9.8.0. Electron version is 3.0.2
I analyzed bootstrap.js file in node_modules\msnodesqlv8\lib\bootstrap.js, line number 63. It traced to below code
var files = require('fs').readdirSync(binaryDir)
I changed that too nodeRequire, but it didnt work.
I have checked similar issues in github but none of the resolutions helped.
UPDATED I analyzed the bootstrap.js in msnodesqlv8. These are the different error messages
Error while exporting binary Error: \?\C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bin\sqlserverv8.electron.v2.0.4.ia32.node is not a valid Win32 application. \?\C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bin\sqlserverv8.electron.v2.0.4.ia32.node at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20) at Object.Module._extensions..node (internal/modules/cjs/loader.js:740) at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:166:20) at Module.load (internal/modules/cjs/loader.js:620) at tryModuleLoad (internal/modules/cjs/loader.js:559) at Function.Module._load (internal/modules/cjs/loader.js:551) at Module.require (internal/modules/cjs/loader.js:658) at require (internal/modules/cjs/helpers.js:20) at attemptToExportBinary (C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:58) at C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:48
Error while exporting binary Error: The module '\?\C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bin\sqlserverv8.electron.v2.0.4.x64.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 57. This version of Node.js requires NODE_MODULE_VERSION 64. Please try re-compiling or re-installing the module (for instance, using
npm rebuild
ornpm install
). at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20) at Object.Module._extensions..node (internal/modules/cjs/loader.js:740) at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:166:20) at Module.load (internal/modules/cjs/loader.js:620) at tryModuleLoad (internal/modules/cjs/loader.js:559) at Function.Module._load (internal/modules/cjs/loader.js:551) at Module.require (internal/modules/cjs/loader.js:658) at require (internal/modules/cjs/helpers.js:20) at attemptToExportBinary (C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:58) at C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:48Error while exporting binary Error: \?\C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bin\sqlserverv8.node.v10.8.0.ia32.node is not a valid Win32 application. \?\C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bin\sqlserverv8.node.v10.8.0.ia32.node at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20) at Object.Module._extensions..node (internal/modules/cjs/loader.js:740) at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:166:20) at Module.load (internal/modules/cjs/loader.js:620) at tryModuleLoad (internal/modules/cjs/loader.js:559) at Function.Module._load (internal/modules/cjs/loader.js:551) at Module.require (internal/modules/cjs/loader.js:658) at require (internal/modules/cjs/helpers.js:20) at attemptToExportBinary (C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:58) at C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:48