Node Webkit 无法安装 SQLite3 模块

Node Webkit Unable to install SQLite3 Module

我是 Node.JS 和 Node WebKit 的新手。我正尝试按照网站给我的说明安装 Node WebKit 的 SQLite3 包

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

我的 package.json 文件在我的目录中

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

然后我执行了第一个必需的命令

npm install nw-gyp -g

这似乎有效,然后我尝试安装 SQLite3 模块

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

我也试过了

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

但是这是失败的,日志也不是很有帮助

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

我从哪里开始尝试解决这个问题

更新

这个问题可能与nw-gyp有关。我运行

npm install nw-gyp -g

这似乎没问题,但如果我尝试使用它然后我得到一个错误,如果我 运行

nw-gyp configure --target=0.12.3

我收到一个错误

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

更新 02

我要安装 Visual Studio Express 看看是否能解决问题。这可能需要很长时间

我 运行 遇到了与您类似的问题,我可以通过执行以下操作来解决它。

安装 Visual Studio Express 2012 或 2010。 之后安装 Python 和 确保 您设置了构建路径。如果您使用安装程序,通常会有一个选项要求您为您设置。

使用以下命令安装SQLite

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

不要忘记 --save,因为它会将安装保存到您的 package.json。这是 node-webkit 找到它所必需的。

更新 在 cmd 中使用 echo %PATH% 你可以看到你的路径。添加 Python 看起来像这样 set PYTHONPATH=%PYTHONPATH%;C:\My_python_lib 取决于您安装的位置 python