安装sqlite3时node-pre-gyp出错
Error with node-pre-gyp when installing sqlite3
在工作中,我们有一个网站 (WIP),它获取 SQLite 数据库的一些数据。由于网站使用 Javascript 作为后端,我们尝试在我们托管网站的服务器上安装 sqlite3 作为演示。
它使用 Windows7(32 位),2 GB RAM。 Node 和 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、更新了 windows、安装了 Python 2.7,但这没有帮助。当前版本是:
Node: v10.16.3
NPM: v6.9.0
这是一个常见问题,当您更改节点版本而不重建 npm 包时会发生这种情况
执行以下步骤
- 使用 Microsoft 的 windows-build-tools 安装所有必需的工具和配置,使用
npm install --global --production windows-build-tools
来自提升的 PowerShell 或 CMD.exe(运行 作为管理员)。 reference
npm install -g node-gyp
或 npm rebuild node-gyp
如果您已经拥有它
npm install sqlite3
在工作中,我们有一个网站 (WIP),它获取 SQLite 数据库的一些数据。由于网站使用 Javascript 作为后端,我们尝试在我们托管网站的服务器上安装 sqlite3 作为演示。
它使用 Windows7(32 位),2 GB RAM。 Node 和 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、更新了 windows、安装了 Python 2.7,但这没有帮助。当前版本是:
Node: v10.16.3
NPM: v6.9.0
这是一个常见问题,当您更改节点版本而不重建 npm 包时会发生这种情况
执行以下步骤
- 使用 Microsoft 的 windows-build-tools 安装所有必需的工具和配置,使用
npm install --global --production windows-build-tools
来自提升的 PowerShell 或 CMD.exe(运行 作为管理员)。 reference npm install -g node-gyp
或npm rebuild node-gyp
如果您已经拥有它npm install sqlite3