0
votes

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 [email protected]
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 [email protected] install: `node-pre-gyp install --fallback-to-build`
2630 error Exit status 1
2631 error Failed at the [email protected] 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 [email protected]
2635 info uninstall [email protected]
2636 verbose unbuild rmStuff [email protected] from C:\PROG\NodeJS\Programs\NodeWebKit\node_modules
2637 info postuninstall [email protected]
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

1
Could be windows related. I've only ever used sqlite3 on linux. That being said, have you check nw-gyp is installed in %AppData%/npm/ (as a cmd or batch file) and the module itself under %AppData%/npm/node_modules? - chriskelly
and %NODE_PATH% is set to %AppData%\npm\node_modules? - chriskelly
looking at those instructions, they seem to be for a linux system! all paths and commands are for linux . Does it say somewhere its supported on windows? - chriskelly
The link you put in your post. I see lots of linux examples, some osx but no windows example or mention of windows. I just tried on windows and I get errors too. - chriskelly
good point! Do you have a compatile compiler installed to build it? e.g. visual studio. (stackoverflow.com/questions/21562038/…) - chriskelly

1 Answers

1
votes

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