Node-sqlite3: Cannot find module 'sqlite3' for build - but in dev it's working

Created on 27 Apr 2017  路  1Comment  路  Source: mapbox/node-sqlite3

In node-webkit (nw js) I've installed sqlite3:

npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=x64 --target="0.22.0"

When calling

nw src/

it's working as expected. I can read/write etc. the sqlite-database. (This is in developer mode)

But when calling

nwbuild --platforms win64 --buildDir dist/ src/

and after starting the app, no output will come from the database. After F12 I got the message:

_Uncaught Error: Cannot find module 'sqlite3'
at Function.Module._resolveFilename (module.js:494:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:522:17)
at require (internal/module.js:20:19)
at self.require (:11:26)_

In the folder node_modules there is indeed the "sqlite3" directory with the files. And the package.json file seems to be ok:

{
"name": "medicusV1",
"description": "my main description",
"version": "1.0.0",
"build": {
"nwVersion": "0.22.0"
},
"devDependencies": {
"nw": "^0.22.0"
},
"scripts": {
"dev": "nw src/",
"prod": "nwbuild --platforms win64 --buildDir dist/ src/"
},
"dependencies": {
"sqlite3": "^3.1.8"
}

}

Does anybody know, how build the app with the sqlite module?

Most helpful comment

Try --save parameter on install, I always do that while installing something I want in prod.

>All comments

Try --save parameter on install, I always do that while installing something I want in prod.

Was this page helpful?
0 / 5 - 0 ratings