Trent Trent - 22 days ago 8
Node.js Question

Node Webkit Unable to install SQLite3 Module

I'm very new to Node.JS and Node WebKit. I am trying to install the SQLite3 package for Node WebKit by following the instructions that the site has given me

https://github.com/mapbox/node-sqlite3

I am in my directory with my package.json file

{
"name": "First",
"description": "First attempt",
"author": "Person",
"main": "index.html",
"window": {
"toolbar": false,
"width": 600,
"height": 400
},
"license": "ISC"
}


And I did the first required command

npm install nw-gyp -g


which seems to have worked, then I tried to install the SQLite3 Module

npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=ia32 --target=$("0.12.3")


I also tried

npm install sqlite3 --runtime=node-webkit --target_arch=x64 --target=0.12.3


But this is failing and the log wasn't terribly helpful

2623 verbose pkgid sqlite3@3.1.1
2624 verbose cwd C:\PROG\NodeJS\Programs\NodeWebKit
2625 error Windows_NT 10.0.10586
2626 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "sqlite3" "--build-from-source" "--runtime=node-webkit" "--target_arch=ia32" "--target=$(0.12.3)"
2627 error node v4.2.5
2628 error npm v2.14.12
2629 error code ELIFECYCLE
2630 error sqlite3@3.1.1 install: `node-pre-gyp install --fallback-to-build`
2630 error Exit status 1
2631 error Failed at the sqlite3@3.1.1 install script 'node-pre-gyp install --fallback-to-build'.
2631 error This is most likely a problem with the sqlite3 package,
2631 error not with npm itself.
2631 error Tell the author that this fails on your system:
2631 error node-pre-gyp install --fallback-to-build
2631 error You can get their info via:
2631 error npm owner ls sqlite3
2631 error There is likely additional logging output above.
2632 verbose exit [ 1, true ]
2633 verbose unbuild node_modules\sqlite3
2634 info preuninstall sqlite3@3.1.1
2635 info uninstall sqlite3@3.1.1
2636 verbose unbuild rmStuff sqlite3@3.1.1 from C:\PROG\NodeJS\Programs\NodeWebKit\node_modules
2637 info postuninstall sqlite3@3.1.1
2638 silly gentlyRm C:\PROG\NodeJS\Programs\NodeWebKit\node_modules\sqlite3 is being purged from base C:\PROG\NodeJS\Programs\NodeWebKit
2639 verbose gentlyRm don't care about contents; nuking C:\PROG\NodeJS\Programs\NodeWebKit\node_modules\sqlite3
2640 silly vacuum-fs purging C:\PROG\NodeJS\Programs\NodeWebKit\node_modules\sqlite3
2641 silly vacuum-fs removing C:\PROG\NodeJS\Programs\NodeWebKit\node_modules
2642 silly vacuum-fs finished vacuuming up to C:\PROG\NodeJS\Programs\NodeWebKit


Where do I start attempting to resolve this

UPDATE

This problem may be related to the nw-gyp. I ran

npm install nw-gyp -g


Which seemed ok but if I try to use it then I get an error, if I run

nw-gyp configure --target=0.12.3


I get an error

'nw-gyp' is not recognized as an internal or external command, operable program or batch file


UPDATE 02

I'm going to Install Visual Studio Express to see if this fixes it. This may take a long time

Answer

I ran into similar problems as you did and I could fix it by doing the following.

Install Visual Studio Express 2012 or 2010. Afterwards Install Python and make sure that you set the build path. There is usually a option asking you to set the for you, if you use the installer.

Use the following command to install SQLite

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

Don't forget the --save as it will save the installation to your package.json. This is necessary for node-webkit to find it.

UPDATE With echo %PATH% in cmd you can see your path. Adding Python would look like this set PYTHONPATH=%PYTHONPATH%;C:\My_python_lib Depending on where you installed python