1

I want to use sqlite3 with this boilerplate:

https://github.com/bradstewart/electron-boilerplate-vue

I've tried a lot of ways getting require('sqlite3'), to work, but it keeps failing with the error:

Uncaught Error: Cannot find module 'sqlite3'
  • global.require() did not work
  • adding it to the webpack.ExternalsPlugin in builds/webpack.base.conf.js did not help

How can I solve this?

Artisan72
  • 3,052
  • 3
  • 23
  • 30

1 Answers1

2

This should be able to help you: How to use sqlite3 module with electron?

Basically:

  1. Install electron-rebuild: npm i electron-rebuild --save-dev
  2. Launch electron-rebuild ./node_modules/.bin/electron-rebuild (or .\node_modules\.bin\electron-rebuild.cmd on windows)

  3. Go to "node_modules/sqlite3/lib/binding/" and rename the folder "electron-v0.36-darwin-x64" to "node-v47-darwin-x64"

Community
  • 1
  • 1
willyb321
  • 310
  • 3
  • 9