Loading Native module sqlite fails
See original GitHub issuePre-flight checklist
- I have read the contribution documentation for this project.
- I agree to follow the code of conduct that this project uses.
- I have searched the issue tracker for a bug that matches the one I want to file, without success.
Electron Forge version
6.0.0-beta.61
Electron version
15.3.1
Operating system
Windows 10 (19043)
Last known working Electron Forge version
No response
Expected behavior
Expect when i add the native module sqlite3, it works fine.
Actual behavior
Electron threw an error during loading:
Error: node-loader: Error: xxxxxxxxx\my-new-app.webpack\main\797c785640ebd2acfcdb58106aa54b96.node is not a valid Win32 application. xxxxxxxxx\my-new-app.webpack\main\797c785640ebd2acfcdb58106aa54b96.node at Object.<anonymous> (xxxxxxxxx\my-new-app.webpack\main\index.js:14328:9) at Object…/node_modules/sqlite3/lib/binding/napi-v3-win32-x64/node_sqlite3.node (xxxxxxxxx\my-new-app.webpack\main\index.js:14331:30) at webpack_require (xxxxxxxxx\my-new-app.webpack\main\index.js:21:30) at Object…/node_modules/sqlite3/lib/sqlite3-binding.js (C:\Users\emide\Desktop\my-new-app.webpack\main\index.js:14345:15) at webpack_require (xxxxxxxxx\my-new-app.webpack\main\index.js:21:30) at Object…/node_modules/sqlite3/lib/sqlite3.js (xxxxxxxxx\my-new-app.webpack\main\index.js:14359:15) at webpack_require (xxxxxxxxx\my-new-app.webpack\main\index.js:21:30) at Object…/src/main.js (xxxxxxxxx\my-new-app.webpack\main\index.js:15828:15) at webpack_require (xxxxxxxxx\my-new-app.webpack\main\index.js:21:30) at xxxxxxxxx\my-new-app.webpack\main\index.js:85:18 webpack built a31995d6bc66e85e33ab in 1971ms
Steps to reproduce
yarn create electron-app my-new-app --template=webpack cd my-new-app yarn add sqlite3
Add in the main.js the following code:
var sqlite3 = require('sqlite3')
yarn run start
Additional information
If I set in webpack the package sqlite3 as “externals”, the “yarn run start” run fine, but the application built with “yarn run package” fails to start with the same error.
I also tried to replace “@marshallofsound/webpack-asset-relocator-loader” with “@vercel/webpack-asset-relocator-loader” and I get the same situations.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (1 by maintainers)
Top GitHub Comments
@erickzhao It wasn’t me who opened this. In the OP it was @emidelgo and they were saying they couldn’t use
sqlite3
. I posted to say that I can usebetter-sqlite3
– which someone else on this site recommended – in case that’s a useful alternative.The new release of better-sqlite3 include PR 870 which fixes the problem it had compiling for the latest version of Electron