Not able to run electron app, throwing error because of sqlite3

Hey, I’m not able to start my electron app using ‘yarn start’. It’s always throwing an error -

An unhandled error has occurred inside Forge:
node-gyp failed to rebuild ‘/Users/abhi/Documents/desktop-app/mf-desktop-app/node_modules/sqlite3’.
Error: make failed with exit code: 2

I’m using the following versions -
OS : Mac OS Big Sur
Sqlite3: 5.0.0
Node: 14.15.4

More logs regarding this -
⠇ Preparing native dependencies: 0 / 1clang: error: no such file or directory: ‘Systems/desktop-app/mf-desktop-app/node_modules/sqlite3/11.0.3/include/node’
clang: error: no such file or directory: ‘Systems/desktop-app/mf-desktop-app/node_modules/sqlite3/11.0.3/src’
clang: error: no such file or directory: ‘Systems/desktop-app/mf-desktop-app/node_modules/sqlite3/11.0.3/deps/openssl/config’
clang: error: no such file or directory: ‘Systems/desktop-app/mf-desktop-app/node_modules/sqlite3/11.0.3/deps/openssl/openssl/include’
⠏ Preparing native dependencies: 0 / 1clang: error: no such file or directory: ‘Systems/desktop-app/mf-desktop-app/node_modules/sqlite3/11.0.3/deps/uv/include’
clang: error: no such file or directory: ‘Systems/desktop-app/mf-desktop-app/node_modules/sqlite3/11.0.3/deps/zlib’
clang: error: no such file or directory: ‘Systems/desktop-app/mf-desktop-app/node_modules/sqlite3/11.0.3/deps/v8/include’
⠋ Preparing native dependencies: 0 / 1make: *** [Release/obj.target/nothing/…/node-addon-api/src/nothing.o] Error 1
:heavy_multiplication_x: Preparing native dependencies: 0 / 1

Though I’m not facing any issue during installation of sqlite3 package.

Node version of SQLite doesn’t work with Electron, you have to rebuild it specifically for Electron.

Use electron-rebuild, eg;

“electron-rebuild -f -w sqlite3”

1 Like