Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install sqlite3 takes forever

I am trying to install sqlite3 for use in node.js. However, the installation takes forever and is stuck at the bottom line below.

I have waited at least 15 minutes for anything to happen.

I have also tried installing with --build-from-source appended, with same same result.

The device I am installing on is a Raspberry Pi, and rebooting it does not solve the issue. Other packages such as socket.io has been installed successfully previously.

npm install sqlite3
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
/
> [email protected] install /home/pi/ServerGPS/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

child_process: customFds option is deprecated, use stdio instead.
child_process: customFds option is deprecated, use stdio instead.
make: Entering directory '/home/pi/ServerGPS/node_modules/sqlite3/build'
  ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3080900/sqlite3.c
  TOUCH Release/obj.target/deps/action_before_build.stamp
  CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3080900/sqlite3.o
like image 937
user3262713 Avatar asked Jul 05 '15 13:07

user3262713


3 Answers

I originally thought that @travisWebb answer correct, but with time even that build failed with a Unable to copy file... error. Going back to try and find a solution I came across a post on GitHub looking for a way to make sure I had the build essentials. I came across this answer instead and it worked, relatively quickly at that.

sudo apt-get install libsqlite3-dev
npm install sqlite3 --build-from-source --sqlite=/usr
like image 83
QueueHammer Avatar answered Oct 21 '22 22:10

QueueHammer


I suggest you take a look at dblite. Is a wrapper for sqlite.

var dblite = require('dblite'),
    db = dblite('file.name');

// Asynchronous, fast, and ...
db.query('SELECT * FROM table', function(err, rows) {
  // ... that easy!
});

npm install dblite

like image 37
Akima Avatar answered Oct 21 '22 20:10

Akima


The device I am installing on is a Raspberry Pi,

The sqlite3 driver is a native module, and needs to be compiled during installation. This compilation will take much longer on a slower processor.

like image 28
Travis Webb Avatar answered Oct 21 '22 22:10

Travis Webb