Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js says it can't load sqlite3 module, but does anyway

I'm working with the new Node.js Tools for Visual Studio and included the sqlite3 npm module. When I call require('sqlite3') it throws the error:

Error: Cannot find module './binding\Debug\node-v11-win32-ia32\node_sqlite3.node'

Odd thing is, when I ignore the error and continue running the code, everything works fine...until the function I'm in returns; then the server crashes.

Has anyone else had this issue? I have a suspicion that it has something to do with the ./binding part, but wouldn't know where to begin in terms of finding out why.

like image 881
Stephen Collins Avatar asked Nov 26 '13 15:11

Stephen Collins


People also ask

Can I use SQLite with node js?

Node. js can be used very well with relational databases and SQLite is no exception.


2 Answers

use this:-

npm install sqlite3 --build-from-source 
like image 112
mitesh Avatar answered Sep 21 '22 09:09

mitesh


This is what worked for me: https://www.npmjs.com/package/sqlite3

npm install https://github.com/mapbox/node-sqlite3/tarball/master 
like image 38
Demodave Avatar answered Sep 23 '22 09:09

Demodave