Reputation: 3653
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.
Upvotes: 30
Views: 55401
Reputation: 1
For me, the root cause was a Dockerfile specifying npm
when it needed to be yarn
for cross OS compatibility.
Upvotes: 0
Reputation: 18937
From: https://github.com/mapbox/node-sqlite3/wiki/Building-On-Windows
npm install sqlite
npm install
node-gyp configure build
Upvotes: 2
Reputation: 526
In case this above has not worked for anyone, here is what worked for me:
sudo apt install node-sqlite3
(I am using Ubuntu with Vscode as editor). It seems installing this node-sqlite3 module was the one that was recognized.
Upvotes: 0
Reputation: 13526
I got the kind of problem, my node
version is v10.16.3
This globally installed sqlite3 gives error in loading by require('sqlite3')
It been solved by install a sqlite3 local to project.
$ npm install sqlite3
Note without -g option, it works for me.
Upvotes: 1
Reputation: 738
To skip searching for pre-compiled binaries, and force a build from source, use
npm install --build-from-source
Upvotes: -1
Reputation: 6632
This is what worked for me: https://www.npmjs.com/package/sqlite3
npm install https://github.com/mapbox/node-sqlite3/tarball/master
Upvotes: 37
Reputation: 3653
It seems this is a problem with the sqlite3
npm package itself. There exists a lib\binding\Release\
folder, but not a lib\binding\Debug\
folder. I just created a copy of the Release
folder, named it Debug
, and all is well.
Upvotes: 0