L
L
Lion Golden2018-01-28 19:06:42
Node.js
Lion Golden, 2018-01-28 19:06:42

How to properly build sqlite3 under node-webkit?

You need to work with an external database file, to work with it, connect the sqlite3 module of the node, to do this, rebuild NW.
I didn’t try everything to build sqlite3 under node-webkit... I
basically followed the instructions www.technerium.ru/nwjs/vklyuchenie-sqlite3-v-proek...
At the last step, when building sqlite3, a bunch of errors fly out

spoiler
npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=x64 --target=0.28.0
> [email protected] install C:\Users\LiOn\Desktop\PS\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build
File "", line 1
import sys; print sys.byteorder
^
SyntaxError: invalid syntax
gyp: Call to 'python -c "import sys; print sys.byteorder"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Users\LiOn\AppData\Roaming\npm\node_modules\nw-gyp\lib\configure.js:359:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\LiOn\\AppData\\Roaming\\npm\\node_modules\\nw-gyp\\bin\\nw-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\LiOn\\Desktop\\PS\\node_modules\\sqlite3\\lib\\binding\\node-webkit-v0.28.0-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\Users\\LiOn\\Desktop\\PS\\node_modules\\sqlite3\\lib\\binding\\node-webkit-v0.28.0-win32-x64" "--python=python2.7" "--msvs_version=2015"
gyp ERR! cwd C:\Users\LiOn\Desktop\PS\node_modules\sqlite3
gyp ERR! node -v v8.9.4
gyp ERR! nw-gyp -v v3.6.3
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'nw-gyp.cmd configure --fallback-to-build --module=C:\Users\LiOn\Desktop\PS\node_modules\sqlite3\lib\binding\node-webkit-v0.28.0-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\LiOn\Desktop\PS\node_modules\sqlite3\lib\binding\node-webkit-v0.28.0-win32-x64 --python=python2.7 --msvs_version=2015' (1)
node-pre-gyp ERR! stack at ChildProcess. (C:\Users\LiOn\Desktop\PS\node_modules\sqlite3\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Windows_NT 10.0.16299
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\LiOn\\Desktop\\PS\\node_modules\\sqlite3\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\LiOn\Desktop\PS\node_modules\sqlite3
node-pre-gyp ERR! node -v v8.9.4
node-pre-gyp ERR! node-pre-gyp -v v0.6.38
node-pre-gyp ERR! not ok
Failed to execute 'nw-gyp.cmd configure --fallback-to-build --module=C:\Users\LiOn\Desktop\PS\node_modules\sqlite3\lib\binding\node-webkit-v0.28.0-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\LiOn\Desktop\PS\node_modules\sqlite3\lib\binding\node-webkit-v0.28.0-win32-x64 --python=python2.7 --msvs_version=2015' (1)
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\LiOn\AppData\Roaming\npm-cache\_logs\2018-01-28T07_28_14_473Z-debug.log

I tried just
npm install sqlite3 --build-from-source
So it collects but cannot find it when compiling the project
node_modules\sqlite3\lib\binding\node-webkit-v0.28.0-win32-x64\node_sqlite3.node

maybe there
node_modules\sqlite3\lib\binding\node-v57-win32-x64\node_sqlite3.node

I even tried stupidly renaming the existing folder to the required one, but from this, errors already appear in nw.js.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lion Golden, 2018-01-29
@nimayoleynik

Accidentally found better-sqlite3 which is much faster than just sqlite3. The Troubleshooting installation
instruction was also attached there (what to do in case of errors during installation), thanks to it, everything was successfully assembled. There were several problems: 1) python 3.x version, when only 2.x is supported. 2) There was no Visual Studio 2015 (there were 2008, 2010, 2013, 2017), but 2015 was needed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question