Cannot run electron tests when using better-sqlite3


I recently created an application using the electron-vue boilerplate and am having trouble with testing dependencies. When I run yarn test, I get the following error:

Child html-webpack-plugin for "index.html":
                                   Asset      Size  Chunks             Chunk Names
                              index.html    568 kB       1          44 bytes          [emitted]  
       [0] ./node_modules/html-webpack-plugin/lib/loader.js!./src/index.ejs 1.46 kB {1} [built]
       [1] ./node_modules/lodash/lodash.js 540 kB {1} [built]
       [2] (webpack)/buildin/module.js 517 bytes {1} [built]
19 01 2018 02:30:17.603:INFO [karma]: Karma v1.7.1 server started at
19 01 2018 02:30:17.605:INFO [launcher]: Launching browser visibleElectron with unlimited concurrency
19 01 2018 02:30:17.618:INFO [launcher]: Starting browser Electron
19 01 2018 02:30:19.579:INFO [Electron 1.7.9 (Node 7.9.0)]: Connected on socket XnzwV7bi3QYEDoyCAAAA with id 16128747
Electron 1.7.9 (Node 7.9.0) ERROR
  Uncaught Error: Could not locate the bindings file. Tried:
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/build/better_sqlite3.node
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/build/Debug/better_sqlite3.node
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/build/Release/better_sqlite3.node
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/out/Debug/better_sqlite3.node
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/Debug/better_sqlite3.node
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/out/Release/better_sqlite3.node
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/Release/better_sqlite3.node
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/build/default/better_sqlite3.node
   → /home/cassius/workspace/tagister/node_modules/better-sqlite3/compiled/7.9.0/linux/x64/better_sqlite3.node
  at webpack:///node_modules/bindings/bindings.js:96:0 <- index.js:30116

Electron 1.7.9 (Node 7.9.0): Executed 0 of 0 ERROR (1.957 secs / 0 secs)

However, all those module seem to be present:

find $HOME/workspace/tagister/node_modules/better-sqlite3/ -name "*node"

I’m not really sure what’s going on here. I’ve gotten no response on Stack Overflow. I was wondering if it might be an electron bug, but my question was closed without any examination.

Full steps to reproduce the issue:

git clone
git checkout ca712c4c
yarn test

I’m really stuck on why my tests can’t seem to resolve the same dependencies that run fine in development mode.


Maybe this long ago post but i got the solution on this.

Its the problem with your node, i got it solve by folowing the trouble shooting guides in better-sqlite3.

Or you can do by (if you use nvm and have a lot of globaly installed module) unninstall all globaly nodule or node then simply npm install and run that again