electron-with-sqlite3
electron-with-sqlite3 copied to clipboard
Cannot find module 'sqlite3'
I cloned your repo in hopes of getting sqlite3 to work with Electron after trying for several hours, looking at different resources online. Unfortunately your repo doesn't seem to work either.
This is what I did immediately after cloning your repo
First I ran npm install
and got the error that the comment needs to be removed, so I did that.
Then when running npm install
again there were a lot of install errors related to sqlite (npm ERR! Failed at the [email protected] install script.
).
Then, after ignoring that warning and running npm run rebuild
followed by npm start
I get the error Electron failed to install correctly, please delete node_modules/electron and try installing again
. So I ran npm install --save electron
(no errors here).
With this done I ran npm start
and got lots of error messages, starting with Error: Cannot find module 'sqlite3'
.
Note; I'm on macOS Mojave.
Maybe you should do this: For people who even tried to manually install and update everything but still didn`t work, try this:
(OFC install electron and sqlite3)
Instead of electron-rebuild do npm i --save-dev electron-builder
add to scripts the following line "postinstall": "electron-builder install-app-deps"
Then do npm run postinstall
. This should rebuild native dependencies. After this i was able to npm start
and everything worked properly.
I faced the similar issue. I was able to resolve it by doing that
This is on Windows OS
@talktojoegee I can confirm, your solution works on macOS Mojave, thanks!
@talktojoegee thank you for you help. iwas able to run it but the results (i.e the data from database) are not showing. It gives me an error saying: "Uncaught ReferenceError: require is not defined at main.html:5". You did not have this issue ?
My little app runs and I don't see any errors, but the data in the database does not show when running the app. I do see the data in the database when i view the database directly using DB Browser for SQLite. Anyone have any information?
@talktojoegee thank you for you help. iwas able to run it but the results (i.e the data from database) are not showing. It gives me an error saying: "Uncaught ReferenceError: require is not defined at main.html:5". You did not have this issue ?
Same issue on macOS.
Tried to npm i --save-dev electron-builder
, add postinstall": "electron-builder install-app-deps
and npm run postinstall
.
Nothing changes.
Uncaught Error: Cannot find module '.../node_modules/sqlite3/lib/binding/napi-v6-darwin-x64/node_sqlite3.node'