Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite3 with Electron 13

Currently trying to use sqlite3 with electron 13.1 and Node 14.17.3.

Running electron-forge start results in:

/home/victor/workplace/project/node_modules/node-addon-api/napi-inl.h: In member function ‘bool Napi::Object::Freeze()’:
/home/victor/workplace/project/node_modules/node-addon-api/napi-inl.h:1393:24: error: ‘napi_object_freeze’ was not declared in this scope; did you mean ‘napi_object_expected’?
 1393 |   napi_status status = napi_object_freeze(_env, _value);
      |                        ^~~~~~~~~~~~~~~~~~
      |                        napi_object_expected
/home/victor/workplace/project/node_modules/node-addon-api/napi-inl.h: In member function ‘bool Napi::Object::Seal()’:
/home/victor/workplace/project/node_modules/node-addon-api/napi-inl.h:1399:24: error: ‘napi_object_seal’ was not declared in this scope; did you mean ‘napi_object’?
 1399 |   napi_status status = napi_object_seal(_env, _value);
      |                        ^~~~~~~~~~~~~~~~
      |                        napi_object
⠴ Building module: sqlite3, Completed: 0../src/b

Looking at the readme of SQLite here, it seems like support for Electron 13.1 is not available.

Is there any known workaround (that I could not find) or even another (compatible) package?

like image 307
Victor Avatar asked Apr 30 '26 05:04

Victor


1 Answers

I solved this by overriding the sqlite node-addon-api dependency. If you are using yarn, you can add the following lines to the package.json file:

"resolutions": {
"sqlite3/node-addon-api": "3.1.0" }
like image 192
user2870277 Avatar answered May 02 '26 18:05

user2870277



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!