sqllite3 install on node and macos give error

Viewed 743

I have a sqllite database (.db) file which I want to connect to using node. I assume I need to use the package sqlite3. However when I try to install this I get the following error

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! sqlite3@4.2.0 install: node-pre-gyp install --fallback-to-build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the sqlite3@4.2.0 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

My node version is 14.3.0. From what I checked I need to use sqlite3 to connect to the .db file. Is there some other package I can use or does anyone know how to fix this error ?

1 Answers

I struggled with this issue on Ubuntu 20.04, node version 14.5.0 until when i came across sqlite3 npm documentation. Simply execute the following commands if you are on Ubuntu 20.04:

  1. sudo apt-get install libsqlite3-dev
  2. Navigate to your project directory and then execute npm i sqlite3
Related