question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Loading Native module sqlite fails

See original GitHub issue

Pre-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:closed
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
cwellsxcommented, Nov 22, 2022

@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 use better-sqlite3 – which someone else on this site recommended – in case that’s a useful alternative.

1reaction
cwellsxcommented, Nov 22, 2022

The new release of better-sqlite3 include PR 870 which fixes the problem it had compiling for the latest version of Electron

Read more comments on GitHub >

github_iconTop Results From Across the Web

Loading Native module sqlite fails · Issue #2611 · electron/forge
Expect when i add the native module sqlite3, it works fine. Actual behavior. Electron threw an error during loading: Error: node-loader: Error: ...
Read more >
Native module SQLite tried to override SQLitePlugin.check the ...
I have a working Android react native app ( react native v 0.60.5 ). I tried to use Sqlite storage in my apps...
Read more >
sqlite3 — DB-API 2.0 interface for SQLite databases — Python ...
Tutorial teaches how to use the sqlite3 module. Reference describes the classes and functions this module defines. How-to guides details how to handle...
Read more >
react-native-quick-sqlite - npm
Quick SQLite embeds the latest version of SQLite and provides a low-level JSI-backed API to execute SQL queries. By using an embedded SQLite...
Read more >
SQLite - Expo Documentation
To open a new SQLite database using an existing .db file you already have, follow the steps below: 1. Install expo-file-system and expo-asset...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found