Node Webkit无法安装SQLite3模块

时间:2016-01-23 11:59:01

标签: node.js module sqlite node-webkit

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

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

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

89208713065

我做了第一个必需的命令

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

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

npm install nw-gyp -g

我也试过

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

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

更新

这个问题可能与nw-gyp有关。我跑了

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

这似乎没问题,但如果我尝试使用它,那么我会收到错误,如果我运行

npm install nw-gyp -g

我收到错误

nw-gyp configure --target=0.12.3

更新02

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

1 个答案:

答案 0 :(得分:1)

我遇到了类似的问题,我可以通过执行以下操作来修复它。

安装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的位置

相关问题