在工作中,我们有一个网站(WIP),可以获取SQLite数据库的一些数据。由于该网站使用Javascript作为后端,因此我们尝试在非正式托管该网站的服务器上安装sqlite3进行演示。

它使用Windows 7(32位)和2 GB RAM。节点和NPM已安装,当我们尝试“ npm install sqlite3”时,唯一的麻烦发生了。该部分运行无错误,但是当执行“ node-pre-gyp install --fallback-to-build”时,将导致以下错误:

2778 warn system32@1.0.0 No description
2779 warn system32@1.0.0 No repository field.
2780 verbose stack Error: sqlite3@4.1.0 install: `node-pre-gyp install --fallback-to-build`
2780 verbose stack Exit status 1
2780 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
2780 verbose stack     at EventEmitter.emit (events.js:198:13)
2780 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
2780 verbose stack     at ChildProcess.emit (events.js:198:13)
2780 verbose stack     at maybeClose (internal/child_process.js:982:16)
2780 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
2781 verbose pkgid sqlite3@4.1.0
2782 verbose cwd C:\Windows\system32
2783 verbose Windows_NT 6.1.7601
2784 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "sqlite3"
2785 verbose node v10.16.3
2786 verbose npm  v6.9.0
2787 error code ELIFECYCLE
2788 error errno 1
2789 error sqlite3@4.1.0 install: `node-pre-gyp install --fallback-to-build`
2789 error Exit status 1
2790 error Failed at the sqlite3@4.1.0 install script.
2790 error This is probably not a problem with npm. There is likely additional logging output above.
2791 verbose exit [ 1, true ]


我已经更新了节点npm,全局安装的node-gyp,更新了的窗口,安装了Python 2.7,但这没有帮助。当前版本是:

Node: v10.16.3
NPM: v6.9.0

最佳答案

这是一个常见的问题,它发生在您更改节点版本而未重建npm软件包时

进行以下步骤


使用Microsoft的Windows-Build-tools通过提升的PowerShell或CMD.exe(以管理员身份运行)使用npm install --global --production windows-build-tools安装所有必需的工具和配置。 reference
npm install -g node-gypnpm rebuild node-gyp(如果已有)
npm install sqlite3

关于node.js - 安装sqlite3时Node-pre-gyp错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58073775/

10-16 22:29